From 84d3536c00c9a77f5713eb2213c1723349d70ee7 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@DESKTOP-5BIMHQ3> Date: 星期三, 20 三月 2024 16:58:15 +0800 Subject: [PATCH] PDA拣货拼托功能开发 --- Wms/WMS.Entity/DataEntity/DataStockDetail.cs | 7 Wms/Wms/Controllers/PdaSoController.cs | 63 + Wms/Model/ModelVm/PdaVm/PdaSoVm.cs | 5 Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs | 796 +++++++++++++++++++ Pda/View/SoSetting/pinTuoOut.html | 1537 +++++++++++++++++++++++++++++++++++++ Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs | 23 6 files changed, 2,431 insertions(+), 0 deletions(-) diff --git a/Pda/View/SoSetting/pinTuoOut.html b/Pda/View/SoSetting/pinTuoOut.html new file mode 100644 index 0000000..8670568 --- /dev/null +++ b/Pda/View/SoSetting/pinTuoOut.html @@ -0,0 +1,1537 @@ +<!DOCTYPE html> +<html> + +<head> + <meta charset="UTF-8" /> + <meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" /> + <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=2.0, user-scalable=no" /> --> + <meta http-equiv="X-UA-Compatible" content="ie=edge" /> + <title>Boxline PDA</title> + + <link rel="stylesheet" href="/layui/css/layui.css" /> + <link rel="stylesheet" href="/css/style.css" /> + <script src="/js/adaptive.js"></script> + + <link rel="stylesheet" href="/css/my.css" /> + <style type="text/css"> + .layout-bill-info { + height: auto; + /* background-color: #009E94; */ + } + + .layout-tbl-submit { + margin-top: 10px; + } + + /* .out-scatter-num { + background-color: #009688; + + } */ + .out-scatter-num .local-input { + width: 40%; + height: 25px; + float: left; + } + + .out-scatter-num .local-ok button { + height: 25px; + border: 0; + color: #FFFFFF; + background-color: #0a93e3; + border-radius: 3px; + padding: 2px; + margin-left: 10px; + width: 100%; + } + + .out-scatter-num .layui-input-block { + width: 100%; + /* background-color: #009E94; */ + margin-left: 0; + } + + .out-scatter-num .local-ok { + width: 20%; + height: 25px; + float: left; + } + + .btn-ok-blue { + border: none; + color: #FFFFFF; + background-color: #0a93e3; + width: 48%; + height: 36px; + border-radius: 5px; + } + + .btn-ok-red { + border: none; + color: #FFFFFF; + background-color: #9f1707; + width: 48%; + height: 36px; + border-radius: 5px; + } + + .btn-ok-blue:active { + opacity: 0.8; + } + + .btn-ok-red:active { + opacity: 0.8; + } + + .layout-tbl-paging { + margin-top: 20px; + } + + .foot-container { + text-align: center; + } + + .layout-tab-page { + height: auto; + } + + .layui-form-checkbox { + margin: auto; + /* padding-left: 2px; */ + /* padding-right: 2px; */ + } + + .div-tbl-title { + width: 98%; + margin: auto; + /* background-color: #4476A7; */ + height: 30px; + } + + .div-tbl-title table { + width: 100%; + height: 30px; + } + + td { + word-break: break-all; + word-wrap: break-word; + } + + .layui-input-block .layui-input, + .layui-input-block .layui-textarea { + padding-left: 0rem; + font-size: 13px; + } + + .lableWidth { + width: 17%; + } + + .layui-input-block { + width: 83%; + margin-left: 17%; + } + + .layui-form-switch { + margin-top: 0; + } + ul { + list-style-type: none; + padding: 0; + } + + li { + cursor: pointer; + background-color: lightgray; + padding: 10px; + margin-bottom: 5px; + } + </style> + <link rel="stylesheet" href="/css/adapter.css" /> +</head> + +<body> + <div id="" class="main-content"> + <div id="" class="layout-title"> + <table border="" cellspacing="" cellpadding=""> + <tr> + <td class="img-back"><a href="../index.html"><img src="/assets/back.jpg"></a></td> + <td class="title-text">鎷h揣鎷兼墭</td> + <td class="title-menu-icon"><img id="menuImg" src="/assets/menu.jpg"></td> + </tr> + </table> + </div> + <div id="" class="layout-sub-content"> + <div id="menuList" class="menu"> + <ul class="" style="text-align: center;"> + <li><a href="../index.html">涓婚〉</a></li> + <li><a href="../login.html">閲嶆柊鐧诲綍</a></li> + </ul> + </div> + + <!-- <ul> + <li id="option1">鏍囩</li> + <li id="option2">鏁伴噺</li> + </ul> --> + + <button id="option1" class="layout-btn" type="button">鏍囩</button> + <button id="option2" class="layout-btn" type="button">鏁伴噺</button> + <br /><br /> + + <!-- 鏈夌爜 --> + <div id="content1"> + + <div id="" class="layout-bill-info"> + <form class="layui-form" action="" style="height: auto;"> + + <div id="layout-bill" class="layui-form-item layout-dropdownlist"> + <label class="layui-form-label lableWidth">鍑哄簱鍗曪細</label> + <div class="layui-input-block" id="selectDiv"> + <select id="bar" lay-filter="getbar" lay-search> + <option value=""></option> + </select> + <img src="/assets/down_arraw.png"> + </div> + </div> + <div id="layout-skuLotNo" class="layui-form-item layout-dropdownlist"> + <label class="layui-form-label lableWidth">鐗╂枡 - 鎵规锛�</label> + <div class="layui-input-block"> + <select id="skuLotNo" lay-filter="getSkuLotNo" lay-search> + <option value=""></option> + </select> + <img src="/assets/down_arraw.png"> + </div> + </div> + <div id="" class="layout-tab-page"> + <table class="tbl-box-sim-info" border="" cellspacing="" cellpadding=""> + <tr> + <td> + <div class="layui-form-item"> + <label class="layui-form-label" style="width: 50%;">璁″垝鏁伴噺锛�</label> + <div class="layui-input-block" style="width: 50%;margin-left:50%;"> + <input id="planQty" type="text" lay-verify="" disabled placeholder="" + class="layui-input"> + </div> + </div> + </td> + <td> + <div class="layui-form-item"> + <label class="layui-form-label" style="width: 50%">瀹屾垚鏁伴噺锛�</label> + <div class="layui-input-block" style="width: 50%;margin-left:50%;"> + <input id="finishQty" type="text" lay-verify="" disabled placeholder="" + class="layui-input"> + </div> + </div> + + </td> + <td> + <div class="layui-form-item"> + <label class="layui-form-label" style="width: 34%;">鍑哄簱鍙o細</label> + <div class="layui-input-block" style="width: 66%;margin-left:34%;"> + <input id="outModel" type="text" lay-verify="" disabled placeholder="" + class="layui-input"> + </div> + </div> + </td> + </tr> + <tr> + <td colspan="3"> + <div class="layui-form-item"> + <label class="layui-form-label" style="width: 17%;">瑙勬牸锛�</label> + <div class="layui-input-block" style="width: 83%;margin-left:17%;"> + <input id="standard" type="text" lay-verify="" disabled placeholder="" + class="layui-input"> + </div> + </div> + </td> + + </tr> + </table> + </div> + + <div id="layout-pallet" class="layui-form-item layout-input"> + <label class="layui-form-label lableWidth">鎵樼洏鏉$爜锛�</label> + <div class="layui-input-block"> + <input id="palletNo" type="text" lay-verify="stock" placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" autocomplete="off" + class="layui-input" style="height:24px"> + </div> + </div> + <div id="" class="layui-form-item layout-input"> + <label class="layui-form-label" lang>鏄惁鏁存墭鍑哄簱锛�</label> + <div class="layui-input-block"> + <input type="checkbox" name="IsZhengTuo" id="IsZhengTuo" lay-skin="switch" lay-text="鏄瘄鍚�" + lay-filter="IsZhengTuo"> + </div> + </div> + <div id="BoxDIv" class="layout-tab-page"> + <table class="layout-tab-content" border="" cellspacing="" cellpadding=""> + <tr> + <td> + <div class="layui-form-item layout-input"> + <label class="layui-form-label lableWidth">澶栫鏉$爜锛�</label> + <div class="layui-input-block"> + <input id="boxNo" type="text" placeholder="璇锋壂鎻忓绠辨潯鐮�" autocomplete="off" + class="layui-input"> + </div> + </div> + </td> + </tr> + <!-- <tr> + <td> + <div class="layui-form-item layout-input" style="margin-top: 6px;"> + <label class="layui-form-label lableWidth">鍐呯鏉$爜锛�</label> + <div class="layui-input-block"> + <input id="boxNo2" type="text" placeholder="璇锋壂鎻忓绠辨潯鐮�" autocomplete="off" + class="layui-input"> + </div> + </div> + </td> + </tr> --> + <tr> + <td> + <div class="layui-form-item layout-input" style="margin-top: 6px;"> + <label class="layui-form-label lableWidth">杩芥函鏉$爜锛�</label> + <div class="layui-input-block"> + <input id="boxNo3" type="text" lang langholder placeholder="璇锋壂鎻忚拷婧潯鐮�" + autocomplete="off" class="layui-input"> + </div> + </div> + </td> + </tr> + <tr class="divPickQty1"> + <td> + <div class="layui-form-item layout-input" style="margin-top: 6px;"> + <label class="layui-form-label lableWidth">鎷h揣鏁伴噺锛�</label> + <div class="layui-input-block"> + <input id="pickQty1" type="number" placeholder="璇疯緭鍏ユ嫞璐ф暟閲�"autocomplete="off" + class="layui-input" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"> + </div> + </div> + </td> + </tr> + + </table> + </div> + <div id="layout-pallet" class="layui-form-item layout-input" style="margin-top: 5px;"> + <label class="layui-form-label lableWidth">鏂版墭鐩樻潯鐮侊細</label> + <div class="layui-input-block"> + <input id="palletNo3" type="text" lay-verify="stock" placeholder="璇锋壂鎻忔柊鎵樼洏鏉$爜" autocomplete="off" + class="layui-input" style="height:24px"> + </div> + </div> + <div id="" class="layout-tab-page"> + <table class="layout-tab-content" border="" cellspacing="" cellpadding=""> + <tr> + <td> + <table class="tbl-box-sim-info" border="" cellspacing="" cellpadding=""> + <tr> + <td> + <div class="layui-form-item"> + <label class="layui-form-label lableWidth">寰呮嫞鏁伴噺锛�</label> + <div class="layui-input-block"> + <input id="pickQty" type="text" lay-verify="" disabled + placeholder="" class="layui-input"> + </div> + </div> + </td> + <td> + <div class="layui-form-item"> + <label class="layui-form-label lableWidth">宸叉嫞鏁伴噺锛�</label> + <div class="layui-input-block"> + <input id="pickedQty" type="text" lay-verify="" disabled + placeholder="" class="layui-input"> + </div> + </div> + </td> + <!-- <td> + <div class="layui-form-item "> + <label class="layui-form-label lableWidth">绠卞唴鏁伴噺锛�</label> + <div class="layui-input-block"> + <input id="boxQty" class="layui-input" style="border: 0;" + type="text" lay-verify="" disabled placeholder=""> + </div> + </div> + </td> --> + </tr> + </table> + </td> + </tr> + </table> + <table class="layout-tab-content"> + <tr> + <td style="width: 33%;"></td> + <td> + <button class="layout-btn layout-btn-red" lang type="button" lay-submit + lay-filter="formPickScatter">鎷h揣</button> + </td> + <td style="width: 33%;"></td> + <!-- <td> + <div id="layout-qty" class="layui-form-item out-scatter-num" style="margin-top: 15px;"> + <label class="layui-form-label lableWidth" >鎷h揣鏁伴噺锛�</label> + <div id="" class="local-input"> + <div class="layui-input-block"> + <input id="qty" type="number" placeholder="璇疯緭鍏ユ嫞璐ф暟閲�" + autocomplete="off" class="layui-input" style="padding-left:0.1rem;" + oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"> + </div> + </div> + <div id="" class="local-ok"> + <button type="button" lay-submit lay-filter="formPickScatter">纭</button> + </div> + </div> + </td> --> + </tr> + </table> + <div id="" style="text-align: right;margin-top: 10px;"> + <div id="" class="cut-line"> + <img src="/assets/fengexian.png"> + </div> + </div> + </div> + + </form> + </div> + + <div class="layout-tbl-paging" id=""> + <table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding=""> + <tr id="tableHead"> + <th style="width: 54%;">瀹瑰櫒缂栫爜</th> + <th style="width: 20%;">绠卞唴<br>鏁伴噺</th> + <th style="width: 20%;">宸叉嫞<br>鏁伴噺</th> + <!-- <th style="width: 14%;">宸叉嫞<br>鏁伴噺</th> --> + <!-- <th style="width: 8%;">鎷h揣</th> --> + </tr> + <tr id="boxCell" style="display: none;"> + <td name="boxNo">AG000001</td> + <td name="qty">30</td> + <td name="pickedQty">30</td> + </tr> + </table> + + <!-- 鍒嗛〉 --> + <table id="tableBoxPages" class="tbl-box-pages" border="" cellspacing="" cellpadding=""> + <tr> + <td class="page-prev">涓婁竴椤�</td> + <td class="page-num page-num-select">1</td> + <td class="page-num">2</td> + <td class="page-num">3</td> + <td class="page-num">4</td> + <td class="page-num">5</td> + <td class="page-next">涓嬩竴椤�</td> + </tr> + </table> + </div> + </div> + <!-- 鏃犵爜 --> + <div id="content2"> + + <div id="" class="layout-bill-info"> + <form class="layui-form" action="" style="height: auto;"> + + <div id="layout-bill2" class="layui-form-item layout-dropdownlist"> + <label class="layui-form-label lableWidth">鍑哄簱鍗曪細</label> + <div class="layui-input-block" id="selectDiv2"> + <select id="bar2" lay-filter="getbar2" lay-search> + <option value=""></option> + </select> + <img src="/assets/down_arraw.png"> + </div> + </div> + <div id="layout-skuLotNo2" class="layui-form-item layout-dropdownlist"> + <label class="layui-form-label lableWidth">鐗╂枡 - 鎵规锛�</label> + <div class="layui-input-block"> + <select id="skuLotNo2" lay-filter="getSkuLotNo2" lay-search> + <option value=""></option> + </select> + <img src="/assets/down_arraw.png"> + </div> + </div> + <div id="" class="layout-tab-page"> + <table class="tbl-box-sim-info" border="" cellspacing="" cellpadding=""> + <tr> + <td> + <div class="layui-form-item"> + <label class="layui-form-label" style="width: 50%;">璁″垝鏁伴噺锛�</label> + <div class="layui-input-block" style="width: 50%;margin-left:50%;"> + <input id="planQty2" type="text" lay-verify="" disabled placeholder="" + class="layui-input"> + </div> + </div> + </td> + <td> + <div class="layui-form-item"> + <label class="layui-form-label" style="width: 50%">瀹屾垚鏁伴噺锛�</label> + <div class="layui-input-block" style="width: 50%;margin-left:50%;"> + <input id="finishQty2" type="text" lay-verify="" disabled placeholder="" + class="layui-input"> + </div> + </div> + + </td> + </tr> + <tr> + <td colspan="3"> + <div class="layui-form-item"> + <label class="layui-form-label" style="width: 17%;">瑙勬牸锛�</label> + <div class="layui-input-block" style="width: 83%;margin-left:17%;"> + <input id="standard2" type="text" lay-verify="" disabled placeholder="" + class="layui-input"> + </div> + </div> + </td> + + </tr> + </table> + </div> + + <div id="layout-pallet" class="layui-form-item layout-input"> + <label class="layui-form-label lableWidth">鎵樼洏鏉$爜锛�</label> + <div class="layui-input-block"> + <input id="palletNo2" type="text" lay-verify="stock" placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" autocomplete="off" + class="layui-input" style="height:24px"> + </div> + </div> + + <div id="layout-pallet" class="layui-form-item layout-input"> + <label class="layui-form-label lableWidth">鏂版墭鐩樻潯鐮侊細</label> + <div class="layui-input-block"> + <input id="palletNo4" type="text" lay-verify="stock" placeholder="璇锋壂鎻忔柊鎵樼洏鏉$爜" autocomplete="off" + class="layui-input" style="height:24px"> + </div> + </div> + <div class="layui-form-item layout-input" style="display: flex; justify-content: space-between;"> + <div style="width: 49%;"> + <label class="layui-form-label" style="width: 34%;">鍑哄簱鍙o細</label> + <div class="layui-input-block" style="width: 62%;margin-left:34%;"> + <input id="outModel2" type="text" lay-verify="" disabled placeholder="" + class="layui-input" > <!-- style="border: 0px;" --> + </div> + </div> + <div style="width: 49%;"> + <label class="layui-form-label" style="width: 70px;">宸叉嫞鏁伴噺锛�</label> + <div class="layui-input-block" style="width: 120px; margin-left:70px;"> + <input id="pickedQty2" type="text" lay-verify="" disabled + placeholder="" class="layui-input" > + </div> + </div> + </div> + + <div id="" class="layout-tab-page"> + + <table class="layout-tab-content"> + <tr> + <td> + <div id="layout-qty" class="layui-form-item out-scatter-num" > + <label class="layui-form-label lableWidth" >鎷h揣鏁伴噺锛�</label> + <div id="" class="local-input"> + <div class="layui-input-block"> + <input id="pickQty2" type="number" placeholder="璇疯緭鍏ユ嫞璐ф暟閲�" + autocomplete="off" class="layui-input" style="padding-left:0.1rem;" + oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"> + </div> + </div> + <div id="" class="local-ok"> + <button type="button" lay-submit lay-filter="formPickScatter2">纭</button> + </div> + </div> + </td> + </tr> + </table> + <div id="" style="text-align: right;margin-top: 10px;"> + <div id="" class="cut-line"> + <img src="/assets/fengexian.png"> + </div> + </div> + </div> + + </form> + </div> + + <div class="layout-tbl-paging" id=""> + <table id="tableBoxList2" class="tbl-box-list" border="" cellspacing="" cellpadding=""> + <tr id="tableHead2"> + <th style="width: 54%;">鐗╂枡缂栫爜</th> + <th style="width: 20%;">鎵樺唴<br>鏁伴噺</th> + <th style="width: 20%;">宸叉嫞<br>鏁伴噺</th> + <!-- <th style="width: 14%;">宸叉嫞<br>鏁伴噺</th> --> + <!-- <th style="width: 8%;">鎷h揣</th> --> + </tr> + <tr id="boxCell2" style="display: none;"> + <td name="SkuNo">AG000001</td> + <td name="Qty">30</td> + <td name="pickedQty">30</td> + </tr> + </table> + + <!-- 鍒嗛〉 --> + <table id="tableBoxPages2" class="tbl-box-pages" border="" cellspacing="" cellpadding=""> + <tr> + <td class="page-prev">涓婁竴椤�</td> + <td class="page-num page-num-select">1</td> + <td class="page-num">2</td> + <td class="page-num">3</td> + <td class="page-num">4</td> + <td class="page-num">5</td> + <td class="page-next">涓嬩竴椤�</td> + </tr> + </table> + </div> + </div> + + </div> + + </div> + + + <script src="/js/jquery-3.5.1.min.js"></script> + <script src="/layui/layui.js"></script> + <script src="/js/jquery.cookie.js"></script> + <script src="/js/public.js"></script> + + <script> + layui.use(['form', 'jquery'], function () { + var form = layui.form; + + /* 鏍囩鍒囨崲浠g爜 */ + + var xianshiyemian = 0; + + $('#option1').attr("style", "background-color: red;width: 50%;float: left;text-align: center;"); //閫変腑鍚庨鑹� + $('#option2').attr("style", "background-color: #999;width: 50%;float: right;text-align: center;"); //榛樿棰滆壊 + $('#content2').hide(); + $(document).ready(function () { + $('#option1').click(function () { + // qingkong(); + xianshiyemian = 0; + $('#content1').show(); + $('#option1').attr("style", "background-color: red;width: 50%;float: left;text-align: center;"); //閫変腑鍚庨鑹� + + $('#content2').hide(); + $('#option2').attr("style", "background-color: #999;width: 50%;float: right;text-align: center;"); //榛樿棰滆壊 + $("#palletNo").focus();//鍏夋爣榛樿閫変腑 + }); + + $('#option2').click(function () { + // qingkong(); + xianshiyemian = 1; + $('#content1').hide(); + $('#option1').attr("style", "background-color: #999;width: 50%;float: left;text-align: center;"); //榛樿棰滆壊 + + $('#content2').show(); + $('#option2').attr("style", "background-color: red;width: 50%;float: right;text-align: center;"); //閫変腑鍚庨鑹� + $("#palletNo2").focus();//鍏夋爣榛樿閫変腑 + }); + }); + + + //褰撳墠鍒嗛〉 + var curPageIndex = 1 + //鏄惁鏁存墭鎷h揣 + var isContinue = "0"; + var tableData = null + var tableData2 = null + var canPickBox = true + $("#palletNo").focus();//鍏夋爣榛樿閫変腑 + + function clear1() { + $('#outModel').val("");//鍑哄簱鍙� + $('#standard').val("");//瑙勬牸 + + $('#pickQty').val("");//寰呮嫞鏁伴噺 + $('#pickedQty').val("");//宸叉嫞鏁伴噺 + } + function clear2() { + //鐗╂枡鎵规 + $("#skuLotNo").empty() + $("#skuLotNo").append('<option value =>' + '</option>'); + form.render('select'); + } + function clear3() { + $("#planQty").val(""); //璁″垝鏁伴噺 + $("#finishQty").val("");//瀹屾垚鏁伴噺 + } + function clear4() { + $('#boxNo').val("");//绠辩爜 + $('#boxQty').val("");//绠卞唴鏁伴噺 + } + //褰撴墭鐩樻潯鐮佽緭鍏ユ鏂囨湰鏀瑰彉鏃�,妫�鏌ヤ竴涓嬫墭鐩樼姸鎬� + $("#palletNo").on('input', function () { + + if ($("#palletNo").val() == "" || $("#palletNo").val().length < 8) { + return + } + if ($("#palletNo").val().length >= 8) { + $("#palletNo").val($("#palletNo").val().substr(-8)) + } + checkPalletState() + }) + + form.on('switch(IsZhengTuo)', function (obj) { + if (obj.elem.checked) { + $('#BoxDIv').attr("style", "display:none") + isContinue="1"; + } else { + $('#BoxDIv').attr("style", "display:block") + isContinue="0"; + } + $('#boxNo').val(""); + $('#boxNo3').val(""); + }); + + //绠辩爜鏂囨湰妗嗗洖杞︿簨浠� + $("#boxNo").blur(function () { + GetBoxInfo(); + + }); + // $("#boxNo2").blur(function () { + // GetBoxInfo(); + // }); + $("#boxNo3").blur(function () { + + GetBoxInfo(); + }); + + //妫�鏌ユ墭鐩樼姸鎬� + function checkPalletState() { + + var param = { + "PalletNo": $("#palletNo").val() + } + synData(IP + "/PdaSo/IsEnableOkPalletNo", param, 'post', function (res) { + + if (res.code == 0) { //鎴愬姛 + updateBillList(); + if ($('#bar').val() == "") { + clear1(); + return; + } else { + updateSkuLotNoList(); + updateQtyList(); + getBar(); + GetBoxInfo(); + } + + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + } + //涓嬫媺鍗曟嵁閫変腑鍚庝簨浠� + form.on('select(getbar)', function (data) { + if ($('#palletNo').val() == "") { + layer.msg("璇疯緭鍏ユ墭鐩樻潯鐮�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + //鍥炶皟 + }); + return + } + if ($('#bar').val() == "") { + clear1(); + clear2(); + clear3(); + return + } + updateSkuLotNoList(); + updateQtyList(); + getBar(); + GetBoxInfo(); + }); + //涓嬫媺鐗╂枡鎵规閫変腑鍚庝簨浠� + form.on('select(getSkuLotNo)', function (data) { + if ($('#palletNo').val() == "") { + layer.msg("璇疯緭鍏ユ墭鐩樻潯鐮�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + clear1(); + clear3(); + }); + return + } + if ($('#skuLotNo').val() == "") { + clear1(); + clear3(); + return + } + updateQtyList(); + getBar(); + GetBoxInfo(); + }); + + //鍒濆鍖栨覆鏌� 鍑哄簱鍗� + function updateBillList() { + + $("#bar").empty() + $("#bar").append('<option value =>' + '</option>'); + form.render('select'); + + var param = { + PalletNo: $("#palletNo").val(), + }; + synData(IP + "/PdaSo/GetRunSoNoticeList", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + console.log(res.data); + for (var i = 0; i < res.data.length; i++) { + if (i == 0) { + $("#bar").append('<option value =' + res.data[i] + ' selected>' + res.data[i] + '</option>'); + } else { + $("#bar").append('<option value =' + res.data[i] + '>' + res.data[i] + '</option>'); + } + } + form.render('select'); + + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + } + }); + } + + //鍒濆鍖栨覆鏌� 鐗╂枡-鎵规 + function updateSkuLotNoList() { + clear2(); + + var param = { + PalletNo: $("#palletNo").val(), + SoNo: $("#bar").val(), + }; + synData(IP + "/PdaSo/GetSoSkuLotNoListByPallet", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + for (var i = 0; i < res.data.length; i++) { + if (i == 0) { + $("#skuLotNo").append('<option value =' + res.data[i].SoDetailId + ' selected>' + res.data[i].SkuName + " - " + res.data[i].LotNo + '</option>'); + + } else { + $("#skuLotNo").append('<option value =' + res.data[i].SoDetailId + '>' + res.data[i].SkuName + " - " + res.data[i].LotNo + '</option>'); + } + } + form.render('select'); + + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + } + + //鍒濆鍖栨覆鍗曟嵁鐨勮鍒掓暟閲忓拰瀹屾垚鏁伴噺 + function updateQtyList() { + clear3(); + var param = { + SoDetailId: $("#skuLotNo").val(), + }; + synData(IP + "/PdaSo/GetPlanAndFinishQty", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + console.log(res.data); + $("#planQty").val(res.data.PlanQty) + $("#finishQty").val(res.data.FinishQty) + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + } + + //鏍规嵁鍗曟嵁鑾峰彇鍑哄簱鍙� + function getBar() { + clear1(); + + var param = { + PalletNo: $("#palletNo").val(), + SoDetailId: $("#skuLotNo").val(), + } + synData(IP + "/PdaSo/GetOutlets", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + let data = res.data + console.log(res.data); + $('#outModel').val(res.data.OutModel); + $('#standard').val(res.data.Standard); + + $('#pickQty').val(res.data.PickQty); + $('#pickedQty').val(res.data.PickedQty); + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + + } + + //娓叉煋琛ㄦ牸鏁版嵁 + function refreshTable(list) { + //鍏堟竻绌轰竴涓嬩俊鎭垪琛� + let trs = $("#tableBoxList tr") + let len = trs.length + //console.log("tr 鏁伴噺 + " + trs.length) + for (i = len - 1; i >= 2; i--) { + trs[i].remove(); + } + + console.log(list != null); + console.log(list); + if (list != null && list.length > 0) { //鎴愬姛 + + var arrTrs = new Array() + let idx = 0 + for (var i in list) { + // list[i].BoxCode + var tr = $("#boxCell").eq(0).clone(); + tr.appendTo("#tableBoxList"); + // tr.attr('id', list[i].BoxCode) + idx++; + tr.attr('index', idx) + // tr.find("td[name='skuNo']").attr('style', 'max-width:90px;'); + // tr.find("td[name='skuName']").attr('style', 'max-width:120px;'); + tr.find("td[name='boxNo']").html(list[i].BoxNo); + tr.find("td[name='qty']").html(list[i].Qty); + tr.find("td[name='pickedQty']").html(list[i].PickedQty); + + tr.show(); + arrTrs[i] = tr + } + setPages(1, list.length) + canPickBox = true + + } else { //涓嶆垚鍔� + layer.msg("鏃犳暟鎹�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + // $("#boxNum").val(0) + setPages(1, 0) + } + } + + //鑾峰彇鎵樼洏鐗╂枡鍚嶇粏 + function GetBoxInfo() { + let param2 = { + "SoDetailId": $("#skuLotNo").val(), + "PalletNo": $("#palletNo").val(), + "BoxNo": $("#boxNo").val(), + "BoxNo3": $("#boxNo3").val(), + } + synData(IP + "/PdaSo/GetDataComBoxInfo", param2, 'post', function (res) { + if (res.code == 0) { + tableData = deepCopy(res.data) + + refreshTable(tableData) + } else { + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + } + + //鍗曟嫞璐э紙纭鎸夐挳锛� + form.on('submit(formPickScatter)', function (data) { + + if ($('#bar').val() == "") { + layer.msg("璇烽�夋嫨鍑哄簱鍗�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); return; + } + if ($('#bar').val() == "") { + layer.msg("璇烽�夋嫨鐗╂枡-鎵规", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); return; + } + if ($('#palletNo').val() == "") { + layer.msg("璇疯緭鍏ユ墭鐩樼爜", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); return; + } + if ($('#palletNo3').val() == "") { + layer.msg("璇疯緭鍏ユ柊鎵樼洏鐮�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); return; + } + if(isContinue=="0"){ + if ($('#boxNo').val() == "") { + layer.msg("璇疯緭鍏ョ鐮�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); return; + } + if ($('#boxQty').val() == "") { + layer.msg("绠卞唴鏁伴噺涓虹┖锛屼笉鑳芥嫞璐�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + if(($('#boxNo3').val() != "" && ($('#pickQty1').val() != "" || $('#pickQty1').val() != 0))){ + layer.msg("杩芥函鏉$爜鍜屾嫞璐ф暟閲忎笉鑳藉悓鏃惰緭鍏ワ紒", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + if($('#pickQty1').val() != "" && $('#pickQty1').val()>parseInt($('#pickQty').val())){ + layer.msg("鎷h揣鏁伴噺涓嶈兘澶т簬寰呮嫞鏁伴噺锛�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + } + // let boxQty = parseInt($('#boxQty').val()) + // let qty = parseInt($('#qty').val()) + // if (qty <= 0 || qty > boxQty) { + // layer.msg("鎷h揣鏁伴噺闇�澶т簬0锛屽苟涓斾笉鑳借秴杩囧緟鎷g鍐呮暟閲�", { + // icon: 2, + // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + // }); + // return; + // } + + if (canPickBox == false) { + + layer.msg("璇锋眰鏈畬鎴愶紝涓嶈閲嶅璇锋眰", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + + reqPickScatter() + + return false; //闃绘琛ㄥ崟璺宠浆銆傚鏋滈渶瑕佽〃鍗曡烦杞紝鍘绘帀杩欐鍗冲彲銆� + }); + + //纭鎷h揣 + function reqPickScatter() { + var param = { + "SoNo": $("#bar").val(), + "SoDetailId": $("#skuLotNo").val(), + "PalletNo": $('#palletNo').val(), + "BoxNo": $('#boxNo').val(), + "BoxNo3": $('#boxNo3').val(), + "PickQty":$('#pickQty1').val(), + "palletNoNew": $('#palletNo3').val(), + } + sendData(IP + "/PdaSo/SoSetPinPick", param, 'post', function (res) { + //console.log(res); + + if (res.code == 0) { //鎴愬姛 + layer.msg(res.msg, { + icon: 1, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + canPickBox = true//鍥炶皟 + $("#boxNo").val(''); + $("#boxNo3").val(''); + updateQtyList(); + getBar(); + GetBoxInfo(); + }); + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + canPickBox = true;//鍥炶皟 + }); + } + }); + } + + //---------------------------------------------------------------------------------- + //涓婚〉鍙婇噸鏂扮櫥褰� + $("#menuImg").click(function (e) { + //console.log("menuImg") + e.stopPropagation() + + if ($("#menuList").is(":hidden")) { + $("#menuList").show() + } else { + $("#menuList").hide() + } + }) + $('body').click(function () { + // //console.log("body") + $("#menuList").hide() + }) + + //璁剧疆鍒嗛〉 + function setPages(pageIndex, boxNum){ + if(boxNum <= 0){ + //鍒楄〃涓虹┖锛岄殣钘忓垎椤甸〉鐮� + $("#tableBoxPages").hide() + return + } + + let pageNum = Math.floor(boxNum / 10); + if(boxNum % 10 > 0){ + pageNum += 1; + } + //console.log("pageNum is " + pageNum) + + $("#tableBoxPages").find("tr").remove() + let table = $("#tableBoxPages") + $("<tr></tr>").appendTo("#tableBoxPages") + + // let newTr = table.append("<tr></tr>") + // newTr.append("<td class='page-prev'>涓婁竴椤�</td>") + $("<td id='prevPage' class='page-prev'>涓婁竴椤�</td>").appendTo("#tableBoxPages tr") + $("#tableBoxPages tr").eq(0).find("td[id^='prevPage']").click(function(){ + onClickPrevPage() + }) + for(i=1; i < pageNum + 1; i++){ + // newTr.append("<td class='page-num'>"+ i +"</td>") + $("<td class='page-num'>"+ i +"</td>").appendTo("#tableBoxPages tr") + } + // newTr.append("<td class='page-next'>涓嬩竴椤�</td>") + $("<td id='nextPage' class='page-next'>涓嬩竴椤�</td>").appendTo("#tableBoxPages tr") + $("#tableBoxPages tr").eq(0).find("td[id^='nextPage']").click(function(){ + onClickNextPage() + }) + // pages.show() + $("#tableBoxPages").show() + + setCurPage(1) + } + + //璁剧疆褰撳墠鍒嗛〉 + function setCurPage(pageIndex){ + let totalTrNum = $("#tableBoxList tr").length + if(totalTrNum <= 2 ){ + //console.log("tableBoxList 涓虹┖ totalTrNum: " + totalTrNum) + //curPageIndex = 1 + return + } + + let pageNum = getBoxPageNum() + if(pageIndex > pageNum){ + //console.log("璁剧疆鐨勯〉鐮佽秴鍑洪〉鏁�, pageIndex : " + pageIndex) + //curPageIndex = 1 + return + } + + let startIndex = (pageIndex - 1) * 10 + 1 + let n = totalTrNum - startIndex + let endIndex = 0 + if(n > 9){ + endIndex = startIndex + 9 + }else{ + endIndex = startIndex + n + } + //console.log("startIndex is "+startIndex) + //console.log("endIndex is "+endIndex) + //startIndex =2 + //endIndex = 2 + let trs = $("#tableBoxList tr") + //console.log("琛屾暟 "+trs.length) + let d = 0 + for(let i = 2; i < trs.length; i++){ + //console.log("琛岀储寮� " + trs.eq(i).attr('index')) + let t = trs.eq(i) + d = t.attr('index') + if(d >= startIndex && d <= endIndex){ + //console.log("闇�瑕佹樉绀�") + //鏄剧ず琛� + t.show() + }else{ + //闅愯棌琛� + t.hide() + } + } + + curPageIndex = pageIndex + + let ptr = $("#tableBoxPages tr") + for(let i = 1; i < pageNum+1; i++){ + ptr.eq(0).find("td").eq(i).removeClass("page-num-select") + if(i == curPageIndex){ + ptr.eq(0).find("td").eq(i).addClass("page-num-select") + } + } + //console.log("totalTrNum is " + totalTrNum) + } + + function onClickPrevPage(){ + //console.log("涓婁竴椤垫寜閽鐐瑰嚮") + if(curPageIndex == 1){ + return + } + setCurPage(curPageIndex - 1) + } + + function onClickNextPage(){ + //console.log("涓嬩竴椤垫寜閽鐐瑰嚮") + let n = getBoxPageNum() + if(curPageIndex == n){ + return + } + setCurPage(curPageIndex + 1) + } + + function getBoxPageNum() + { + let num = $("#tableBoxList tr").length + if(num <= 2 ){ + return 0 + } + + let pageNum = Math.floor(num / 10); + if(num % 10 > 0){ + pageNum += 1; + } + + return pageNum + } + + + //鏁伴噺鏍囩------------------------------------------------------------------------------- + + function clear21() { + $('#outModel2').val("");//鍑哄簱鍙� + $('#standard2').val("");//瑙勬牸 + + $('#pickQty2').val("");//寰呮嫞鏁伴噺 + $('#pickedQty2').val("");//宸叉嫞鏁伴噺 + } + function clear22() { + //鐗╂枡鎵规 + $("#skuLotNo2").empty() + $("#skuLotNo2").append('<option value =>' + '</option>'); + form.render('select'); + } + function clear23() { + $("#planQty2").val(""); //璁″垝鏁伴噺 + $("#finishQty2").val("");//瀹屾垚鏁伴噺 + } + function clear24() { + $('#boxNo2').val("");//绠辩爜 + $('#boxQty2').val("");//绠卞唴鏁伴噺 + } + + + //褰撴墭鐩樻潯鐮佽緭鍏ユ鏂囨湰鏀瑰彉鏃�,妫�鏌ヤ竴涓嬫墭鐩樼姸鎬� + $("#palletNo2").on('input', function () { + if ($("#palletNo2").val() == "" || $("#palletNo2").val().length < 8) { + return + } + if ($("#palletNo2").val().length >= 8) { + $("#palletNo2").val($("#palletNo2").val().substr(-8)) + } + checkPalletState2() + }) + //妫�鏌ユ墭鐩樼姸鎬� + function checkPalletState2() { + var param = { + "PalletNo": $("#palletNo2").val() + } + synData(IP + "/PdaSo/IsEnableOkPalletNo", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + updateBillList2(); + console.log($('#bar2').val()) + if ($('#bar2').val() == "") { + console.log(1) + clear21(); + return; + } else { + console.log(2) + updateSkuLotNoList2(); + updateQtyList2(); + getBar2(); + GetDataInfo(); + } + + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + } + //鍒濆鍖栨覆鏌� 鍑哄簱鍗� + function updateBillList2() { + $("#bar2").empty() + $("#bar2").append('<option value =>' + '</option>'); + form.render('select'); + + var param = { + PalletNo: $("#palletNo2").val(), + }; + synData(IP + "/PdaSo/GetRunSoNoticeList", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + console.log(res.data); + for (var i = 0; i < res.data.length; i++) { + if (i == 0) { + $("#bar2").append('<option value =' + res.data[i] + ' selected>' + res.data[i] + '</option>'); + } else { + $("#bar2").append('<option value =' + res.data[i] + '>' + res.data[i] + '</option>'); + } + } + form.render('select'); + + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + } + }); + } + + //鍒濆鍖栨覆鏌� 鐗╂枡-鎵规 + function updateSkuLotNoList2() { + clear22(); + var param = { + PalletNo: $("#palletNo2").val(), + SoNo: $("#bar2").val(), + }; + synData(IP + "/PdaSo/GetSoSkuLotNoListByPallet", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + for (var i = 0; i < res.data.length; i++) { + if (i == 0) { + $("#skuLotNo2").append('<option value =' + res.data[i].SoDetailId + ' selected>' + res.data[i].SkuName); + if(res.data[i].LotNo == null) + { + $("#skuLotNo2").append(" - " + res.data[i].LotNo); + } + $("#skuLotNo2").append('</option>'); + + } else { + $("#skuLotNo2").append('<option value =' + res.data[i].SoDetailId + '>' + res.data[i].SkuName); + if(res.data[i].LotNo == null) + { + $("#skuLotNo2").append(" - " + res.data[i].LotNo); + } + $("#skuLotNo2").append('</option>'); + } + } + form.render('select'); + + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + } + + //鍒濆鍖栨覆鍗曟嵁鐨勮鍒掓暟閲忓拰瀹屾垚鏁伴噺 + function updateQtyList2() { + clear23(); + var param = { + SoDetailId: $("#skuLotNo2").val(), + }; + synData(IP + "/PdaSo/GetPlanAndFinishQty", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + console.log(res.data); + $("#planQty2").val(res.data.PlanQty) + $("#finishQty2").val(res.data.FinishQty) + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + } + + //鏍规嵁鍗曟嵁鑾峰彇鍑哄簱鍙c�佽鏍笺�佸緟妫�鏁伴噺銆佸凡鎷f暟閲� + function getBar2() { + clear21(); + + var param = { + PalletNo: $("#palletNo2").val(), + SoDetailId: $("#skuLotNo2").val(), + } + synData(IP + "/PdaSo/GetOutlets", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + let data = res.data + console.log(res.data); + $('#outModel2').val(res.data.OutModel); + $('#standard2').val(res.data.Standard); + + $('#pickQty2').val(res.data.PickQty - res.data.PickedQty); + $('#pickedQty2').val(res.data.PickedQty); + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + + } + + //鑾峰彇鎵樼洏鐗╂枡鍚嶇粏 + function GetDataInfo() { + let param2 = { + "SoDetailId": $("#skuLotNo2").val(), + "PalletNo": $("#palletNo2").val(), + } + console.log(param2); + synData(IP + "/PdaSo/GetAllotPlnInfo", param2, 'post', function (res) { + if (res.code == 0) { + tableData2 = deepCopy(res.data) + + refreshTable2(tableData2) + } else { + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + } + + //娓叉煋琛ㄦ牸鏁版嵁 + function refreshTable2(list) { + //鍏堟竻绌轰竴涓嬩俊鎭垪琛� + let trs = $("#tableBoxList2 tr") + let len = trs.length + //console.log("tr 鏁伴噺 + " + trs.length) + for (i = len - 1; i >= 2; i--) { + trs[i].remove(); + } + + console.log(list != null); + console.log(list); + if (list != null && list.length > 0) { //鎴愬姛 + + var arrTrs = new Array() + let idx = 0 + for (var i in list) { + // list[i].BoxCode + var tr = $("#boxCell2").eq(0).clone(); + tr.appendTo("#tableBoxList2"); + // tr.attr('id', list[i].BoxCode) + idx++; + tr.attr('index', idx) + // tr.find("td[name='skuNo']").attr('style', 'max-width:90px;'); + // tr.find("td[name='skuName']").attr('style', 'max-width:120px;'); + tr.find("td[name='SkuNo']").html(list[i].BoxNo); + tr.find("td[name='Qty']").html(list[i].Qty); + tr.find("td[name='pickedQty']").html(list[i].PickedQty); + + tr.show(); + arrTrs[i] = tr + } + setPages(1, list.length) + canPickBox = true + + } else { //涓嶆垚鍔� + layer.msg("鏃犳暟鎹�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + // $("#boxNum").val(0) + setPages(1, 0) + } + } + + //鍗曟嫞璐э紙纭鎸夐挳锛� + form.on('submit(formPickScatter2)', function (data) { + + if ($('#bar2').val() == "") { + layer.msg("璇烽�夋嫨鍑哄簱鍗�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); return; + } + if ($('#skuLotNo2').val() == "") { + layer.msg("璇烽�夋嫨鐗╂枡-鎵规", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); return; + } + if ($('#palletNo2').val() == "") { + layer.msg("璇疯緭鍏ユ墭鐩樼爜", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); return; + } + if ($('#palletNo4').val() == "") { + layer.msg("璇疯緭鍏ユ柊鎵樼洏鐮�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); return; + } + let pickedQty = parseInt($('#pickedQty2').val()) //宸叉嫞鏁伴噺 + let pickQty = parseInt($('#pickQty2').val()) //鎷h揣鏁伴噺 + if (pickQty <= 0) { + layer.msg("鎷h揣鏁伴噺闇�澶т簬0", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + + if (canPickBox == false) { + + layer.msg("璇锋眰鏈畬鎴愶紝涓嶈閲嶅璇锋眰", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + + reqPickScatter2() + + return false; //闃绘琛ㄥ崟璺宠浆銆傚鏋滈渶瑕佽〃鍗曡烦杞紝鍘绘帀杩欐鍗冲彲銆� + }); + + //纭鎷h揣 + function reqPickScatter2() { + var param = { + "SoNo": $("#bar2").val(), + "SoDetailId": $("#skuLotNo2").val(), + "PalletNo": $('#palletNo2').val(), + "PickQty": $('#pickQty2').val(), + "PalletNoNew": $('#palletNo4').val(), + } + sendData(IP + "/PdaSo/SoSetQtyPinPick", param, 'post', function (res) { + //console.log(res); + + if (res.code == 0) { //鎴愬姛 + layer.msg(res.msg, { + icon: 1, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + canPickBox = true//鍥炶皟 + updateQtyList2(); + getBar2(); + GetDataInfo(); + }); + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + canPickBox = true;//鍥炶皟 + }); + } + }); + } + + + }) + </script> +</body> + +</html> \ No newline at end of file diff --git a/Wms/Model/ModelVm/PdaVm/PdaSoVm.cs b/Wms/Model/ModelVm/PdaVm/PdaSoVm.cs index 7d8997a..47db435 100644 --- a/Wms/Model/ModelVm/PdaVm/PdaSoVm.cs +++ b/Wms/Model/ModelVm/PdaVm/PdaSoVm.cs @@ -15,6 +15,11 @@ public string PalletNo { get; set; } /// <summary> + /// 鏂版墭鐩樼爜 + /// </summary> + public string PalletNoNew { get; set; } + + /// <summary> /// 鍑哄簱鍗曞彿 /// </summary> public string SoNo { get; set; } diff --git a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs index 3eaa00c..28f183a 100644 --- a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs +++ b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs @@ -2454,5 +2454,801 @@ throw new Exception(e.Message); } } + + #region 鎷h揣鎷兼墭 + /// <summary> + /// 鎷兼墭鍑哄簱pda鎷h揣-鏍囩 + /// </summary> + /// <param name="soNo"></param> + /// <param name="soDetailId"></param> + /// <param name="palletNo"></param> + /// <param name="boxNo"></param> + /// <param name="boxNo3"></param> + /// <param name="pickQty1"></param> + /// <param name="palletNoNew"></param> + /// <param name="userId"></param> + public void SoSetPinPick(string soNo, string soDetailId, string palletNo, string boxNo, string boxNo3, string pickQty1,string palletNoNew,int userId) + { + Db.BeginTran(); + try + { + var nowDate = DateTime.Now;//褰撳墠鏃堕棿 + #region 鍒ゆ柇 + + if (string.IsNullOrWhiteSpace(soNo)) + { + throw new Exception("鍑哄簱鍗曟嵁涓嶈兘涓虹┖"); + } + if (string.IsNullOrWhiteSpace(soDetailId)) + { + throw new Exception("鍑哄簱鐗╂枡-鎵规涓嶈兘涓虹┖"); + } + if (string.IsNullOrWhiteSpace(palletNo)) + { + throw new Exception("鎵樼洏鐮佷笉鑳戒负绌�"); + } + if (!string.IsNullOrEmpty(boxNo3) && !string.IsNullOrEmpty(pickQty1) && int.Parse(pickQty1) > 0) + { + throw new Exception("杩芥函鏉$爜鍜屾嫞璐ф暟閲忎笉鑳藉悓鏃惰緭鍏�"); + } + if (string.IsNullOrWhiteSpace(palletNoNew)) + { + throw new Exception("鏂版墭鐩樼爜涓嶈兘涓虹┖"); + } + + //鍑哄簱鍗� + var notice = Db.Queryable<BllExportNotice>().First(m => m.IsDel == "0" && m.SONo == soNo); + if (notice == null) + { + throw new Exception("鏈煡璇㈠埌璇ュ嚭搴撳崟鐨勪俊鎭�"); + } + if (notice.Status != "3") + { + throw new Exception("鍑哄簱鍗曠殑鐘舵�佷笉鏄鍦ㄦ墽琛岋紝涓嶈兘鎷h揣"); + } + //鍑哄簱鍗曟槑缁� + var noticeDetail = Db.Queryable<BllExportNoticeDetail>() + .First(m => m.IsDel == "0" && m.Id == int.Parse(soDetailId)); + if (noticeDetail == null) + { + throw new Exception("鏈煡璇㈠埌璇ュ嚭搴撳崟鏄庣粏鐨勪俊鎭�"); + } + //鍑哄簱鍒嗛厤淇℃伅 + var allot = Db.Queryable<BllExportAllot>().First(m => + m.IsDel == "0" && (m.Status == "2" || m.Status == "3") && m.SONo == soNo && + m.SODetailNo == int.Parse(soDetailId) && m.PalletNo == palletNo); + if (allot == null) + { + throw new Exception("鏈煡璇㈠埌璇ユ墭鐩樼殑鍒嗛厤淇℃伅"); + } + //鍓╀綑鎷h揣鏁伴噺锛堝緟鎷e噺鍘诲凡鎷o級 + var needQty = allot.Qty - allot.CompleteQty; + + //搴撳瓨鏄庣粏 + var stockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.Id == allot.StockId); + if (stockDetail == null) + { + throw new Exception("鏈煡璇㈠埌璇ユ墭鐩樺垎閰嶇殑搴撳瓨鏄庣粏淇℃伅锛�"); + } + //搴撳瓨鎬昏〃 + var stock = Db.Queryable<DataStock>().First(a => a.IsDel == "0" && a.SkuNo == stockDetail.SkuNo && a.LotNo == stockDetail.LotNo); + if (stock == null) + { + throw new Exception("鏈煡璇㈠埌璇ユ墭鐩樺垎閰嶇殑搴撳瓨淇℃伅锛�"); + } + + #endregion + + #region 鎷兼墭淇℃伅 + var sdId = 0; + bool isNew = false; + var pinStockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew); + if (pinStockDetail != null) + { + if (pinStockDetail.SONo != notice.SONo) + { + throw new Exception("鎷兼墭鎵樼洏涓婂彧鑳芥斁鍚屼竴涓嚭搴撳崟涓嬬殑鐗╂枡锛�"); + } + if (pinStockDetail.SkuName != stockDetail.SkuName || pinStockDetail.LotNo != stockDetail.LotNo) + { + isNew = true; + } + sdId = pinStockDetail.Id; + } + else + { + isNew = true; + + var newPalletInfo = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew && m.Status=="0"); + if (newPalletInfo == null) + { + throw new Exception("鏂版墭鐩樹俊鎭笉瀛樺湪鎴栧凡琚娇鐢紒"); + } + //淇敼鏂版墭鐩樼姸鎬� + newPalletInfo.Status = "1"; + Db.Updateable(newPalletInfo).ExecuteCommand(); + } + var sd = new DataStockDetail(); + if (isNew) + { + sd.LotNo = stockDetail.LotNo; + sd.LotText = stockDetail.LotText; + sd.SupplierLot = stockDetail.SupplierLot; + sd.SkuNo = stockDetail.SkuNo; + sd.SkuName = stockDetail.SkuName; + sd.Standard = stockDetail.Standard; + + sd.FrozenQty = 0; + sd.InspectQty = 0; + sd.ASNNo = ""; + sd.ASNDetailNo = null; + sd.SONo = soNo;//鍑哄簱鍗曞彿 + sd.WareHouseNo = ""; + sd.RoadwayNo = ""; + sd.AreaNo = ""; + sd.LocatNo = ""; + sd.PalletNo = palletNoNew; + sd.PalletNo2 = ""; + sd.PalletNo3 = ""; + //PalletType = item.PalletType, + sd.CompleteTime = nowDate; + sd.ProductionTime = stockDetail.ProductionTime; + sd.ExpirationTime = stockDetail.ExpirationTime; + sd.Status = "2";//鐘舵�侊紝宸插垎閰� + sd.InspectMark = stockDetail.InspectMark; + sd.InspectStatus = stockDetail.InspectStatus; + sd.BitPalletMark = "0"; + sd.PackagNo = noticeDetail.PackagNo; + sd.IsBale = stockDetail.IsBale; + sd.IsBelt = stockDetail.IsBelt; + sd.Demo = stockDetail.Demo; + sd.OwnerName = stockDetail.OwnerName; + sd.OwnerNo = stockDetail.OwnerNo; + sd.SupplierName = stockDetail.SupplierName; + sd.SupplierNo = stockDetail.SupplierNo; + + sd.IsDel = "0"; + sd.CreateUser = userId; + sd.CreateTime = nowDate; + + //鏂板鎷兼墭搴撳瓨鏄庣粏淇℃伅 + sdId = Db.Insertable(sd).ExecuteReturnIdentity(); + } + #endregion + + var pickQty = 0;//鎷h揣鐨勬暟閲� + if (string.IsNullOrWhiteSpace(boxNo))//鏁存墭鎷h揣 + { + List<DataBoxInfo> boxInfos; + var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo);//鎵惧埌鎵樼洏涓婃墍鏈夌鐮� + boxInfos = boxInfo.ToList(); + if (boxInfo.Count() <= 0) + { + throw new Exception("璇ユ墭鐩樹笂娌℃湁鍙嫞璐х殑绠卞瓙"); + } + var boxQty = boxInfo.GroupBy(m => m.PalletNo).Select(m => SqlFunc.AggregateSum(m.Qty)).ToList(); + if (boxQty[0] > needQty) + { + throw new Exception("鎷h揣鏁伴噺涓嶈兘澶т簬绠卞唴鍓╀綑寰呮嫞鏁伴噺"); + } + + var comDetailList = Db.Queryable<BllCompleteDetail>().Where(m => m.IsDel == "0" && m.ExportAllotId == allot.Id && m.PalletNo == palletNo).ToList(); + var comList = new List<BllCompleteDetail>(); + foreach (var item in boxInfos) + { + if (comDetailList.Any(m => m.BoxNo3 == item.BoxNo3)) + { + throw new Exception($"褰撳墠{item.BoxNo}涓瓄item.BoxNo3}宸叉嫞璐у畬鎴愶紝璇峰嬁閲嶅鎷h揣"); + } + if (item.SkuNo != allot.SkuNo || item.LotNo != allot.LotNo) + { + throw new Exception("褰撳墠鎵樼洏涓婃湁鍏朵粬涓嶅悓鐗╂枡鎵规锛屾嫞璐уけ璐�"); + } + //娣诲姞鎷h揣鏄庣粏 + var completeDetail = new BllCompleteDetail() + { + SONo = soNo, + SODetailNo = int.Parse(soDetailId), + ExportAllotId = allot.Id, + StockId = allot.StockId, + BoxNo = item.BoxNo, + BoxNo2 = item.BoxNo2, + BoxNo3 = item.BoxNo3, + + LotNo = allot.LotNo, + LotText = allot.LotText, + SupplierLot = allot.SupplierLot, + SkuNo = allot.SkuNo, + SkuName = allot.SkuName, + Standard = allot.Standard, + PalletNo = palletNo, + CompleteQty = item.Qty, + + CreateUser = userId + }; + comList.Add(completeDetail); + + //淇敼搴撳瓨绠辩爜鏄庣粏 + item.StockDetailId = sdId; + item.BindNo = null;//鎵樼洏缁戝畾鍙� + item.PalletNo = palletNoNew; + Db.Updateable(item).ExecuteCommand(); + + pickQty += item.Qty; + } + //娣诲姞鎷h揣鏄庣粏 + Db.Insertable(comList).ExecuteCommand(); + //淇敼鍑哄簱鍒嗛厤淇℃伅 + allot.CompleteQty += pickQty; + allot.Status = allot.Qty == allot.CompleteQty ? "5" : "3"; + allot.UpdateTime = DateTime.Now; + Db.Updateable(allot).ExecuteCommand(); + //鍒犻櫎鍘熸墭鐩樺簱瀛樻槑缁� + Db.Deleteable(stockDetail).ExecuteCommand(); + + //鏀瑰彉鎵樼洏鐘舵�佷负锛氭湭浣跨敤 + var pallet = Db.Queryable<SysPallets>().First(m => m.PalletNo == palletNo && m.IsDel == "0"); + if (pallet == null) + { + throw new Exception("鏈湪鎵樼洏琛ㄤ腑鏌ヨ鍒版墭鐩樹俊鎭�"); + } + pallet.Status = "0"; + Db.Updateable(pallet).ExecuteCommand(); + //淇敼鍑哄簱鍗曟槑缁嗘嫞璐ф暟閲� + noticeDetail.CompleteQty += pickQty; + Db.Updateable(noticeDetail).ExecuteCommand(); + + var num = Db.Queryable<BllExportNoticeDetail>() + .Count(m => m.IsDel == "0" && m.SONo == soNo && m.CompleteQty < m.Qty); + if (num <= 0) + { + notice.Status = "4"; //鏇存敼涓烘墽琛屽畬鎴� + } + //淇敼鍑哄簱鍗曚俊鎭� + Db.Updateable(notice).ExecuteCommand(); + } + else + { + var biaoShi = "0";//0锛氭暣绠辨嫞璐с��1锛氭暎鏀嫞璐с��2锛氭暟閲忔嫞璐� + List<DataBoxInfo> boxInfos; + var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == boxNo); + if (boxInfo.Count() == 0) + { + throw new Exception("鏈煡璇㈠埌璇ョ鐮佸強杩芥函鐮佺殑淇℃伅"); + } + boxInfos = boxInfo.ToList(); + + var comDetailList = Db.Queryable<BllCompleteDetail>().Where(m => m.IsDel == "0" && m.ExportAllotId == allot.Id && m.PalletNo == palletNo).ToList(); + if (!string.IsNullOrWhiteSpace(boxNo3)) //鏁f敮鎷h揣 + { + boxInfos = boxInfos.Where(m => m.BoxNo3 == boxNo3).ToList(); + + if (boxInfos.Count() == 0) + { + throw new Exception("鏈煡璇㈠埌璇ョ鐮佸強杩芥函鐮佺殑淇℃伅"); + } + if (boxInfos.Count() > 1) + { + throw new Exception("璇ヨ拷婧敮鐮佺殑淇℃伅澶т簬1鏉★紝淇℃伅閿欒锛岃鏍稿疄锛�"); + } + + if (boxInfos.Any(m => m.PalletNo != palletNo)) + { + throw new Exception("璇ユ墭鐩樹笌绠辩爜娌℃湁缁戝畾鍏崇郴"); + } + var boxQty = boxInfos.First().Qty; + if (boxQty > needQty) + { + throw new Exception("鎷h揣鏁伴噺涓嶈兘澶т簬鍓╀綑寰呮嫞鏁伴噺"); + } + + foreach (var item in boxInfos) + { + if (biaoShi != "2" && comDetailList.Any(m => m.BoxNo3 == item.BoxNo3)) + { + throw new Exception($"褰撳墠{item.BoxNo}涓瓄item.BoxNo3}宸叉嫞璐у畬鎴愶紝璇峰嬁閲嶅鎷h揣"); + } + } + + biaoShi = "1"; + } + else if (!string.IsNullOrEmpty(pickQty1) && int.Parse(pickQty1) > 0)//鏁伴噺鎷h揣 + { + if (boxInfo.Count() > 1) + { + throw new Exception("璇ョ鐮佸唴瀛樺湪鏀爜涓嶈兘杩涜鏁伴噺鎷h揣"); + } + int boxQty = boxInfo.First().Qty; + if (Convert.ToInt32(pickQty1) > boxQty) + { + throw new Exception("鎷h揣鏁伴噺涓嶈兘澶т簬绠卞唴鏁伴噺"); + } + if (Convert.ToInt32(pickQty1) > needQty) + { + throw new Exception("鎷h揣鏁伴噺涓嶈兘澶т簬鍓╀綑寰呮嫞鏁伴噺"); + } + + biaoShi = "2"; + } + else //鏁寸鎷h揣 + { + if (boxInfo.Count() == 0) + { + throw new Exception("鏈煡璇㈠埌璇ョ鐮佺殑淇℃伅"); + } + if (boxInfo.Any(m => m.PalletNo != palletNo)) + { + throw new Exception("璇ユ墭鐩樹笌绠辩爜娌℃湁缁戝畾鍏崇郴"); + } + var boxQty = boxInfo.GroupBy(m => m.BoxNo).Select(m => SqlFunc.AggregateSum(m.Qty)).ToList(); + if (boxQty[0] > needQty) + { + throw new Exception("鎷h揣鏁伴噺涓嶈兘澶т簬绠卞唴鍓╀綑寰呮嫞鏁伴噺"); + } + + foreach (var item in boxInfos) + { + if (biaoShi != "2" && comDetailList.Any(m => m.BoxNo == item.BoxNo)) + { + throw new Exception($"褰撳墠{item.BoxNo}宸叉嫞璐у畬鎴愶紝璇峰嬁閲嶅鎷h揣"); + } + } + } + + var comList = new List<BllCompleteDetail>(); + foreach (var item in boxInfos) + { + //娣诲姞鎷h揣鏄庣粏 + var completeDetail = new BllCompleteDetail() + { + SONo = soNo, + SODetailNo = int.Parse(soDetailId), + ExportAllotId = allot.Id, + StockId = allot.StockId, + BoxNo = item.BoxNo, + BoxNo2 = item.BoxNo2, + BoxNo3 = item.BoxNo3, + + LotNo = allot.LotNo, + LotText = allot.LotText, + SupplierLot = allot.SupplierLot, + SkuNo = allot.SkuNo, + SkuName = allot.SkuName, + Standard = allot.Standard, + PalletNo = palletNo, + CompleteQty = biaoShi == "2" ? int.Parse(pickQty1) : item.Qty, + + CreateUser = userId + }; + comList.Add(completeDetail); + + if (biaoShi == "0")//鏁寸鎷h揣 + { + //淇敼搴撳瓨绠辩爜鏄庣粏 + item.StockDetailId = sdId; + item.BindNo = null;//鎵樼洏缁戝畾鍙� + item.PalletNo = palletNoNew; + Db.Updateable(item).ExecuteCommand(); + + pickQty += item.Qty; + } + else if (biaoShi == "1")//鏁f敮鎷h揣 + { + //淇敼搴撳瓨绠辩爜鏄庣粏 + item.StockDetailId = sdId; + item.BindNo = null;//鎵樼洏缁戝畾鍙� + item.PalletNo = palletNoNew; + item.BoxNo = item.BoxNo3;//灏嗘敮鐮佽祴缁欑鐮� + item.BitBoxMark = "1"; + Db.Updateable(item).ExecuteCommand(); + + pickQty += item.Qty; + } + else//鏁伴噺鎷h揣 + { + if (int.Parse(pickQty1) == item.Qty) + { + //淇敼搴撳瓨绠辩爜鏄庣粏 + item.StockDetailId = sdId; + item.BindNo = null;//鎵樼洏缁戝畾鍙� + item.PalletNo = palletNoNew; + Db.Updateable(item).ExecuteCommand(); + } + else + { + item.Qty -= int.Parse(pickQty1); + item.BitBoxMark = "1";//闆剁鏍囪瘑 + Db.Updateable(item).ExecuteCommand(); + } + + pickQty += int.Parse(pickQty1); + } + } + //鏀瑰彉搴撳唴绠辩爜鏄惁闆剁淇℃伅 + if (biaoShi == "1") + { + var boxSurplusList = boxInfo.Where(m => m.BoxNo3 != boxNo3).ToList(); + foreach (var item in boxSurplusList) + { + item.BitBoxMark = "1"; + Db.Updateable(item).ExecuteCommand(); + } + } + + Db.Insertable(comList).ExecuteCommand(); + //淇敼鍑哄簱鍒嗛厤淇℃伅 + allot.CompleteQty += pickQty; + allot.Status = allot.Qty == allot.CompleteQty ? "5" : "3"; + allot.UpdateTime = DateTime.Now; + if (allot.Status == "5") + { + //鍒ゆ柇璇ユ墭鐩樻槸鍚﹁繕瀛樺湪鐗╂枡 瀛樺湪鏀逛负寰呭洖搴� 寰呭洖搴撳畬鎴愬悗鏀逛负宸插畬鎴� + } + Db.Updateable(allot).ExecuteCommand(); + + //鍒犻櫎鎴栦慨鏀瑰簱瀛樻槑缁� + stockDetail.BitPalletMark = "1";//淇敼涓洪浂鎵樻爣璇� + stockDetail.Qty -= pickQty; + stockDetail.LockQty -= pickQty; + if (stockDetail.Qty == stockDetail.LockQty) + { + stockDetail.Status = "2"; + } + else if (stockDetail.Qty > stockDetail.LockQty && stockDetail.LockQty > 0) + { + stockDetail.Status = "1"; + } + else + { + stockDetail.Status = "0"; + } + + if (stockDetail.Qty <= 0) + { + Db.Deleteable(stockDetail).ExecuteCommand(); + } + else + { + Db.Updateable(stockDetail).ExecuteCommand(); + } + var num2 = Db.Queryable<DataStockDetail>().Count(m => m.IsDel == "0" && m.PalletNo == palletNo); + if (num2 <= 0) + { + //鏀瑰彉鎵樼洏鐘舵�� + var pallet = Db.Queryable<SysPallets>().First(m => m.PalletNo == palletNo && m.IsDel == "0"); + if (pallet == null) + { + throw new Exception("鏈湪鎵樼洏琛ㄤ腑鏌ヨ鍒版墭鐩樹俊鎭�"); + } + pallet.Status = "0"; + Db.Updateable(pallet).ExecuteCommand(); + } + //淇敼鍑哄簱鍗曟槑缁嗘嫞璐ф暟閲� + noticeDetail.CompleteQty += pickQty; + Db.Updateable(noticeDetail).ExecuteCommand(); + + var num = Db.Queryable<BllExportNoticeDetail>() + .Count(m => m.IsDel == "0" && m.SONo == soNo && m.CompleteQty < m.Qty); + if (num <= 0) + { + notice.Status = "4"; //鏇存敼涓烘墽琛屽畬鎴� + } + //淇敼鍑哄簱鍗曚俊鎭� + Db.Updateable(notice).ExecuteCommand(); + } + + if (isNew) + { + sd.Qty = pickQty; + sd.LockQty = pickQty; + } + else + { + //淇敼鎷兼墭鎵樼洏搴撳瓨鏄庣粏 + pinStockDetail.Qty += pickQty; + pinStockDetail.LockQty += pickQty; + Db.Updateable(pinStockDetail).ExecuteCommand(); + } + + //娣诲姞鎿嶄綔鏃ュ織璁板綍 + var k = new OperationSOServer().AddLogOperationSo("PDA妯″潡", "鎷h揣鎷兼墭", soNo, "鎷h揣", $"鍦≒DA涓婂鍑哄簱鍗曞彿涓猴細{soNo}鐨勫師鎵樼洏鐮佷负锛歿palletNo}锛屾柊鎵樼洏鐮佷负锛歿palletNoNew}鐨勬嫞璐ф嫾鎵樻搷浣�", userId); + Db.CommitTran(); + } + catch (Exception e) + { + Db.RollbackTran(); + throw new Exception(e.Message); + } + } + /// <summary> + /// 鎷兼墭鍑哄簱pda鎷h揣-鏁伴噺 + /// </summary> + /// <param name="soNo"></param> + /// <param name="soDetailId"></param> + /// <param name="palletNo"></param> + /// <param name="PickQty"></param> + /// <param name="palletNoNew"></param> + /// <param name="userId"></param> + public void SoSetQtyPinPick(string soNo, string soDetailId, string palletNo, string PickQty,string palletNoNew, int userId) + { + Db.BeginTran(); + try + { + var nowDate = DateTime.Now;//褰撳墠鏃堕棿 + #region 鍒ゆ柇 + + if (string.IsNullOrWhiteSpace(soNo)) + { + throw new Exception("鍑哄簱鍗曟嵁涓嶈兘涓虹┖"); + } + //if (string.IsNullOrWhiteSpace(soDetailId)) + //{ + // throw new Exception("鍑哄簱鐗╂枡-鎵规涓嶈兘涓虹┖"); + //} + if (string.IsNullOrWhiteSpace(palletNo)) + { + throw new Exception("鎵樼洏鐮佷笉鑳戒负绌�"); + } + if (string.IsNullOrWhiteSpace(palletNoNew)) + { + throw new Exception("鏂版墭鐩樼爜涓嶈兘涓虹┖"); + } + + //鍑哄簱鍗� + var notice = Db.Queryable<BllExportNotice>().First(m => m.IsDel == "0" && m.SONo == soNo); + if (notice == null) + { + throw new Exception("鏈煡璇㈠埌璇ュ嚭搴撳崟鐨勪俊鎭�"); + } + if (notice.Status != "3") + { + throw new Exception("鍑哄簱鍗曠殑鐘舵�佷笉鏄鍦ㄦ墽琛岋紝涓嶈兘鎷h揣"); + } + //鍑哄簱鍗曟槑缁� + var noticeDetail = Db.Queryable<BllExportNoticeDetail>() + .First(m => m.IsDel == "0" && m.Id == int.Parse(soDetailId)); + if (noticeDetail == null) + { + throw new Exception("鏈煡璇㈠埌璇ュ嚭搴撳崟鏄庣粏鐨勪俊鎭�"); + } + //鍑哄簱鍒嗛厤淇℃伅 + var allot = Db.Queryable<BllExportAllot>().First(m => + m.IsDel == "0" && (m.Status == "2" || m.Status == "3") && m.SONo == soNo && + m.SODetailNo == int.Parse(soDetailId) && m.PalletNo == palletNo); + if (allot == null) + { + throw new Exception("鏈煡璇㈠埌璇ユ墭鐩樼殑鍒嗛厤淇℃伅"); + } + //鍓╀綑鎷h揣鏁伴噺锛堝緟鎷e噺鍘诲凡鎷o級 + var needQty = allot.Qty - allot.CompleteQty; + if (int.Parse(PickQty) > needQty) + { + throw new Exception("鎷h揣鏁伴噺涓嶈兘澶т簬鎵樺唴鍓╀綑寰呮嫞鏁伴噺"); + } + + //搴撳瓨鏄庣粏 + var stockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.Id == allot.StockId); + if (stockDetail == null) + { + throw new Exception("鏈煡璇㈠埌璇ユ墭鐩樺垎閰嶇殑搴撳瓨鏄庣粏淇℃伅锛�"); + } + //搴撳瓨鎬昏〃 + var stock = Db.Queryable<DataStock>().First(a => a.IsDel == "0" && a.SkuNo == stockDetail.SkuNo && a.LotNo == stockDetail.LotNo); + if (stock == null) + { + throw new Exception("鏈煡璇㈠埌璇ユ墭鐩樺垎閰嶇殑搴撳瓨淇℃伅锛�"); + } + #endregion + + #region 鎷兼墭淇℃伅 + bool isNew = false; + var pinStockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew); + if (pinStockDetail != null) + { + if (pinStockDetail.SONo != notice.SONo) + { + throw new Exception("鎷兼墭鎵樼洏涓婂彧鑳芥斁鍚屼竴涓嚭搴撳崟涓嬬殑鐗╂枡锛�"); + } + if (pinStockDetail.SkuName != stockDetail.SkuName || pinStockDetail.LotNo != stockDetail.LotNo) + { + isNew = true; + } + } + else + { + isNew = true; + + var newPalletInfo = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew && m.Status == "0"); + if (newPalletInfo == null) + { + throw new Exception("鏂版墭鐩樹俊鎭笉瀛樺湪鎴栧凡琚娇鐢紒"); + } + //淇敼鏂版墭鐩樼姸鎬� + newPalletInfo.Status = "1"; + Db.Updateable(newPalletInfo).ExecuteCommand(); + } + + if (isNew) + { + var sd = new DataStockDetail(); + + sd.LotNo = stockDetail.LotNo; + sd.LotText = stockDetail.LotText; + sd.SupplierLot = stockDetail.SupplierLot; + sd.SkuNo = stockDetail.SkuNo; + sd.SkuName = stockDetail.SkuName; + sd.Standard = stockDetail.Standard; + + sd.Qty = int.Parse(PickQty); + sd.LockQty = int.Parse(PickQty); + + sd.FrozenQty = 0; + sd.InspectQty = 0; + sd.ASNNo = ""; + sd.ASNDetailNo = null; + sd.SONo = soNo;//鍑哄簱鍗曞彿 + sd.WareHouseNo = ""; + sd.RoadwayNo = ""; + sd.AreaNo = ""; + sd.LocatNo = ""; + sd.PalletNo = palletNoNew; + sd.PalletNo2 = ""; + sd.PalletNo3 = ""; + //PalletType = item.PalletType, + sd.CompleteTime = nowDate; + sd.ProductionTime = stockDetail.ProductionTime; + sd.ExpirationTime = stockDetail.ExpirationTime; + sd.Status = "2";//鐘舵�侊紝宸插垎閰� + sd.InspectMark = stockDetail.InspectMark; + sd.InspectStatus = stockDetail.InspectStatus; + sd.BitPalletMark = "0"; + sd.PackagNo = noticeDetail.PackagNo; + sd.IsBale = stockDetail.IsBale; + sd.IsBelt = stockDetail.IsBelt; + sd.Demo = stockDetail.Demo; + sd.OwnerName = stockDetail.OwnerName; + sd.OwnerNo = stockDetail.OwnerNo; + sd.SupplierName = stockDetail.SupplierName; + sd.SupplierNo = stockDetail.SupplierNo; + + sd.IsDel = "0"; + sd.CreateUser = userId; + sd.CreateTime = nowDate; + + //鏂板鎷兼墭搴撳瓨鏄庣粏淇℃伅 + Db.Insertable(sd).ExecuteReturnIdentity(); + } + else + { + //淇敼鎷兼墭鎵樼洏搴撳瓨鏄庣粏 + pinStockDetail.Qty += int.Parse(PickQty); + pinStockDetail.LockQty += int.Parse(PickQty); + Db.Updateable(pinStockDetail).ExecuteCommand(); + } + #endregion + + //鑾峰彇褰撳墠鎵樼洏鎷h揣鏄庣粏 + var complete = Db.Queryable<BllCompleteDetail>().First(a => a.IsDel == "0" && a.PalletNo == palletNo && a.SONo == notice.SONo && a.SODetailNo == noticeDetail.Id && a.ExportAllotId == allot.Id && a.StockId == stockDetail.Id); + + //鍒よ鏄惁瀛樺湪鎷h揣鏄庣粏 + int isComplete = 0; + if (complete != null) + { + isComplete = 1; + } + + var comList = new List<BllCompleteDetail>(); + //鍒ゆ柇鏄惁瀛樺湪鎷h揣鏄庣粏 + if (isComplete == 0) + { + //娣诲姞鎷h揣鏄庣粏 + var completeDetail = new BllCompleteDetail() + { + SONo = soNo, + SODetailNo = int.Parse(soDetailId), + ExportAllotId = allot.Id, + StockId = allot.StockId, + BoxNo = "", + BoxNo2 = "", + BoxNo3 = "", + + LotNo = allot.LotNo, + LotText = allot.LotText, + SupplierLot = allot.SupplierLot, + SkuNo = allot.SkuNo, + SkuName = allot.SkuName, + Standard = allot.Standard, + PalletNo = palletNo, + CompleteQty = int.Parse(PickQty), + + CreateUser = userId, + CreateTime = Db.GetDate(), + }; + comList.Add(completeDetail); + + //娣诲姞鎷h揣鏄庣粏 + Db.Insertable(comList).ExecuteCommand(); + } + else if (isComplete == 1) + { + complete.CompleteQty += int.Parse(PickQty); + complete.UpdateUser = userId; + complete.UpdateTime = Db.GetDate(); + + Db.Updateable(complete).ExecuteCommand(); + } + + //淇敼鍑哄簱鍒嗛厤淇℃伅 + allot.CompleteQty += int.Parse(PickQty); + allot.Status = allot.Qty == allot.CompleteQty ? "5" : "3"; + allot.UpdateTime = DateTime.Now; + Db.Updateable(allot).ExecuteCommand(); + + int isDel = 0; + + //鍒犻櫎鎴栦慨鏀瑰簱瀛樻槑缁� + stockDetail.BitPalletMark = "1";//淇敼涓洪浂鎵樻爣璇� + stockDetail.Qty -= int.Parse(PickQty); + stockDetail.LockQty -= int.Parse(PickQty); + if (stockDetail.Qty == stockDetail.LockQty) + { + stockDetail.Status = "2"; + } + else if (stockDetail.Qty > stockDetail.LockQty && stockDetail.LockQty > 0) + { + stockDetail.Status = "1"; + } + else + { + stockDetail.Status = "0"; + } + if (stockDetail.Qty <= 0) + { + Db.Deleteable(stockDetail).ExecuteCommand(); + } + else + { + isDel = 1; + Db.Updateable(stockDetail).ExecuteCommand(); + } + + //鍒ゆ柇鎵樼洏涓婄墿鏂欐槸鍚︽嫞璐у畬姣� + if (isDel == 0) + { + //鏀瑰彉鎵樼洏鐘舵�佷负锛氭湭浣跨敤 + var pallet = Db.Queryable<SysPallets>().First(m => m.PalletNo == palletNo && m.IsDel == "0"); + if (pallet == null) + { + throw new Exception("鏈湪鎵樼洏琛ㄤ腑鏌ヨ鍒版墭鐩樹俊鎭�"); + } + + pallet.Status = "0"; + Db.Updateable(pallet).ExecuteCommand(); + } + + //淇敼鍑哄簱鍗曟槑缁嗘嫞璐ф暟閲� + noticeDetail.CompleteQty += int.Parse(PickQty); + Db.Updateable(noticeDetail).ExecuteCommand(); + + var num = Db.Queryable<BllExportNoticeDetail>() + .Count(m => m.IsDel == "0" && m.SONo == soNo && m.CompleteQty < m.Qty); + if (num <= 0) + { + notice.Status = "4"; //鏇存敼涓烘墽琛屽畬鎴� + } + //淇敼鍑哄簱鍗曚俊鎭� + Db.Updateable(notice).ExecuteCommand(); + + //娣诲姞鎿嶄綔鏃ュ織璁板綍 + var k = new OperationSOServer().AddLogOperationSo("PDA妯″潡", "鎷h揣鎷兼墭", soNo, "鎷h揣", $"鍦≒DA涓婂鍑哄簱鍗曞彿涓猴細{soNo}鐨勬墭鐩樼爜涓猴細{palletNo}锛屾柊鎵樼洏鐮佷负锛歿palletNoNew}鐨勬嫞璐ф搷浣�", userId); + Db.CommitTran(); + } + catch (Exception e) + { + Db.RollbackTran(); + throw new Exception(e.Message); + } + } + #endregion } } diff --git a/Wms/WMS.Entity/DataEntity/DataStockDetail.cs b/Wms/WMS.Entity/DataEntity/DataStockDetail.cs index cf2e213..2c50ba7 100644 --- a/Wms/WMS.Entity/DataEntity/DataStockDetail.cs +++ b/Wms/WMS.Entity/DataEntity/DataStockDetail.cs @@ -124,6 +124,13 @@ public int? ASNDetailNo {get;set;} /// <summary> + /// Desc:鍑哄簱鍗曞彿 + /// Default: + /// Nullable:True + /// </summary> + public string SONo { get; set; } + + /// <summary> /// Desc:鎵�灞炰粨搴� /// Default: /// Nullable:False diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs index a1481b1..37fdb46 100644 --- a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs +++ b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs @@ -144,5 +144,28 @@ void SampleSoSetPick(string soType, string soNo, string soDetailId, string palletNo, string boxNo, string boxNo3, string pickQty1, string asnNo, int userId); + + /// <summary> + /// 鎷兼墭鍑哄簱pda鎷h揣-鏍囩 + /// </summary> + /// <param name="soNo">鍑哄簱鍗�</param> + /// <param name="soDetailId">鍑哄簱鍗曟槑缁咺D</param> + /// <param name="palletNo">鎵樼洏鍙�</param> + /// <param name="boxNo">绠辩爜</param> + /// <param name="boxNo2">鐩掔爜</param> + /// <param name="boxNo3">鏀�/琚嬬爜</param> + /// <param name="palletNo">鏂版墭鐩樺彿</param> + /// <param name="userId">鎿嶄綔浜�</param> + void SoSetPinPick(string soNo, string soDetailId, string palletNo, string boxNo, string boxNo3, string PickQty,string palletNoNew, int userId); + /// <summary> + /// 鎷兼墭鍑哄簱pda鎷h揣-鏁伴噺 + /// </summary> + /// <param name="soNo"></param> + /// <param name="soDetailId"></param> + /// <param name="palletNo"></param> + /// <param name="PickQty"></param> + /// <param name="palletNoNew"></param> + /// <param name="userId"></param> + void SoSetQtyPinPick(string soNo, string soDetailId, string palletNo, string PickQty, string palletNoNew, int userId); } } diff --git a/Wms/Wms/Controllers/PdaSoController.cs b/Wms/Wms/Controllers/PdaSoController.cs index b357110..ce70f47 100644 --- a/Wms/Wms/Controllers/PdaSoController.cs +++ b/Wms/Wms/Controllers/PdaSoController.cs @@ -426,6 +426,69 @@ } + #region 鎷h揣鎷兼墭 + /// <summary> + /// 鎷兼墭鍑哄簱pda鎷h揣-鏍囩 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + public IActionResult SoSetPinPick(PdaSoVm model) + { + try + { + //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D + var claimsIdentity = this.User.Identity as ClaimsIdentity; + if (claimsIdentity == null) + { + return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" }); + } + var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; + if (string.IsNullOrWhiteSpace(userId)) + { + return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" }); + } + _pdaSoSvc.SoSetPinPick(model.SoNo, model.SoDetailId, model.PalletNo, model.BoxNo, model.BoxNo3, model.PickQty, model.PalletNoNew, int.Parse(userId)); + + return Ok(new { code = 0, msg = "鎷h揣瀹屾垚", data = "" }); + } + catch (Exception e) + { + return Ok(new { code = 1, msg = e.Message }); + } + } + /// <summary> + /// 鎷兼墭鍑哄簱pda鎷h揣-鏁伴噺 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + public IActionResult SoSetQtyPinPick(PdaSoVm model) + { + try + { + //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D + var claimsIdentity = this.User.Identity as ClaimsIdentity; + if (claimsIdentity == null) + { + return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" }); + } + var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; + if (string.IsNullOrWhiteSpace(userId)) + { + return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" }); + } + + _pdaSoSvc.SoSetQtyPinPick(model.SoNo, model.SoDetailId, model.PalletNo, model.PickQty, model.PalletNoNew, int.Parse(userId)); + + return Ok(new { code = 0, msg = "鎷h揣瀹屾垚", data = "" }); + } + catch (Exception e) + { + return Ok(new { code = 1, msg = e.Message }); + } + } + #endregion } } -- Gitblit v1.8.0