yangle
2022-03-18 9c65d511c0340561f7a72c0c1b381a6da44e00a5
叫料退料功能
1个文件已修改
388 ■■■■■ 已修改文件
WebTM/views/车间管理/叫料管理/叫料退料单/Jl_CallGoodsBillBackMain.html 388 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/³µ¼ä¹ÜÀí/½ÐÁϹÜÀí/½ÐÁÏÍËÁϵ¥/Jl_CallGoodsBillBackMain.html
@@ -26,19 +26,19 @@
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">开始日期</label>
                                    <label class="layui-form-label">退料日期</label>
                                    <div class="layui-input-block">
                                        <input type="date" class="layui-input" id="HBeginDate" style="width:190px;">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">结束日期</label>
                                    <label class="layui-form-label">-</label>
                                    <div class="layui-input-block">
                                        <input type="date" class="layui-input" id="HEndDate" style="width:190px;">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">单据号</label>
                                    <label class="layui-form-label">报废单号</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="HBillNo" id="HBillNo" style="width:190px;">
                                    </div>
@@ -47,49 +47,71 @@
                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                </button>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">重置</button>
                                <div class="layui-colla-content">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">部门</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HDeptID" id="HDeptID" style="width:190px;">
                                <div class="layui-colla-content" style="margin-left: 4%;">
                                    <div class="layui-row" style="margin-top:10px;">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">物料代码</label>
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                <input type="text" class="layui-input" lay-verify="MaterialNumber" name="MaterialNumber" id="MaterialNumber" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnMaterial" id="btnMaterial" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                </button>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">物料名称</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="MaterialName" lay-verify="MaterialName" id="MaterialName" style="background-color:#efefef4d;" readonly>
                                                <input type="hidden" name="MaterialID" id="MaterialID" lay-verify="MaterialID" value="0">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">物料规格型号</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="MaterialModel" id="MaterialModel" onmouseover="this.title=this.value" readonly>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">物料代码</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="MaterialCode" id="MaterialCode" style="width:190px;">
                                    <div class="layui-row" style="margin-top:10px;">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">生产车间</label>
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                <input type="text" class="layui-input" name="HDeptName" lay-verify="HDeptName" id="HDeptName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHDept" id="btnHDept" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                </button>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">工段</label>
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                <input type="text" class="layui-input" name="ProcMul" lay-verify="ProcMul" id="ProcMul" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnProcMul" id="btnProcMul" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                </button>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label">品质确认</label>
                                            <div class="layui-input-block" style="margin-left: 120px;width: 184px;">
                                                <select name="HPZStatus" lay-verify="HPZStatus" id="HPZStatus">
                                                    <option value="全部">全部</option>
                                                    <option value="已确认">已确认</option>
                                                    <option value="未确认">未确认</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <!--<hr />-->
                                    <div class="layui-inline">
                                        <label class="layui-form-label">物料名称</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="MaterialName" id="MaterialName" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">规格型号</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="SpecificationModel" id="SpecificationModel" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">发料仓库</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="Warehouse" id="Warehouse" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">源单单号</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HSourceBillNo" id="HSourceBillNo" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">制单人</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="Hmaker" id="Hmaker" style="width:190px;">
                                    <div class="layui-row" style="margin-top:10px;">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">仓库接收</label>
                                            <div class="layui-input-block" style="margin-left: 120px;width: 184px;">
                                                <select name="HCKStatus" lay-verify="HCKStatus" id="HCKStatus">
                                                    <option value="全部">全部</option>
                                                    <option value="已接收">已接收</option>
                                                    <option value="未接收">未接收</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>
@@ -98,16 +120,9 @@
                        <table class="" id="mainTable" lay-filter="mainTable"></table>
                        <script type="text/html" id="toolbarDemo">
                            <div class="layui-btn-container">
                                <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="set_AddNew"><i class="layui-icon layui-icon-file-b"></i>新增</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_ShowBill"><i class="layui-icon layui-icon-form"></i>编辑</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-audit"><i class="layui-icon layui-icon-repeat"></i>审核</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Faudit"><i class="layui-icon layui-icon-refresh"></i>反审核</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Refresh"><i class="layui-icon layui-icon-refresh-3"></i>刷新</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Exit"><i class="layui-icon layui-icon-logout"></i>退出</button>-->
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_DeleteBill"><i class="layui-icon layui-icon-delete"></i>删除</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-view"><i class="layui-icon layui-icon-tips"></i>预览</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-print"><i class="layui-icon layui-icon-print"></i>打印</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_PZQRBill"><i class="layui-icon layui-icon-set"></i>品质确认</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_CKJSBill"><i class="layui-icon layui-icon-set"></i>仓库接收</button>
                            </div>
                        </script>
                    </form>
@@ -146,39 +161,41 @@
            //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
            //#region å¤´å·¥å…·æ äº‹ä»¶
            table.on('toolbar(mainTable)', function (obj) {
            table.on("toolbar(mainTable)", function (obj) {
                switch (obj.event) {
                    ////新增
                    //case 'set_AddNew': set_AddNew();
                    //    break;
                    ////编辑
                    //case 'set_ShowBill': set_ShowBill();
                    //    break;
                    //删除
                    case 'set_DeleteBill': set_DeleteBill();
                        break;
                    ////刷新
                    //case 'get_Refresh': get_Refresh();
                    //    break;
                    ////退出按钮
                    //case 'get_Exit': Pub_Close(2);
                    //    break;
                };
            });
            //#endregion
            //#region æŸ¥è¯¢æŒ‰é’®
            form.on('submit(btnSearch)', function (data) {//选择仓位
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery();
            });
            //#endregion
            //选择物料
            form.on('submit(btnMaterial)', function (data) {
                btnMaterial();
            })
            //选择生产车间
            form.on('submit(btnHDept)', function (data) {
                btnHDept();
            })
            //选择工段
            form.on('submit(btnProcMul)', function (data) {
                btnProcMul();
            })
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                set_ClearQuery();
            });
            //#endregion
            //#region æ­¤é¡µé¢æ‰€æœ‰çš„æ–¹æ³•
@@ -199,7 +216,7 @@
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , height: 'full-50'
                    , height: 570
                    , page: true
                    , cellMinWidth: 90
                    , limit: 50
@@ -225,53 +242,112 @@
                        , { field: '关闭类型', title: '关闭类型', width: 170 }
                        , { field: '作废人', title: '作废人' }
                        , { field: '作废日期', title: '作废日期', width: 200, templet: "<div>{{d.作废日期 ==null ?'':layui.util.toDateString(d.作废日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '源单类型', title: '源单类型', width: 170 }
                        , { field: '源单子内码', title: '源单子内码', width: 170 }
                        , { field: '源单号', title: '源单号', width: 170 }
                        , { field: '打印次数', title: '打印次数', width: 170 }
                        , { field: '退料人代码', title: '退料人代码', width: 170 }
                        , { field: '退料人', title: '退料人', width: 170 }
                        , { field: '配送人代码', title: '配送人代码', width: 170 }
                        , { field: '配送人', title: '配送人', width: 170 }
                        , { field: '保管人代码', title: '保管人代码', width: 170 }
                        , { field: '保管人', title: '保管人', width: 170 }
                        , { field: '退料模式', title: '退料模式', width: 170 }
                        , { field: '表体备注', title: '表体备注', width: 170 }
                        , { field: '源单单号', title: '源单单号', width: 170 }
                        , { field: '部门代码', title: '部门代码', width: 170 }
                        , { field: '部门名称', title: '部门名称', width: 170 }
                        , { field: '物料代码', title: '物料代码', width: 170 }
                        , { field: '物料名称', title: '物料名称', width: 170 }
                        , { field: '规格型号', title: '规格型号', width: 215 }
                        , { field: '数量', title: '数量', width: 170 }
                        , { field: '工序代码', title: '工序代码', width: 170 }
                        , { field: '工序名称', title: '工序名称', width: 170 }
                        , { field: '调入仓库代码', title: '调入仓库代码', width: 170 }
                        , { field: '调入仓库名称', title: '调入仓库名称', width: 170 }
                        , { field: '调出仓库代码', title: '调出仓库代码', width: 170 }
                        , { field: '调出仓库名称', title: '调出仓库名称', width: 170 }
                        , { field: '调入仓位名称', title: '调入仓位名称', width: 170 }
                        , { field: '调出仓位名称', title: '调出仓位名称', width: 170 }
                        , { field: '品质判定', title: '品质判定', width: 170 }
                        , { field: '退料原因', title: '退料原因', width: 170 }
                        , { field: '供应商代码', title: '供应商代码', width: 170 }
                        , { field: '供应商名称', title: '供应商名称', width: 170 }
                        , { field: '退料人', title: '退料人', width: 160 }
                        , { field: '搬运人', title: '搬运人', width: 160 }
                        , { field: '验收人', title: '验收人', width: 160 }
                        , { field: '调出组织', title: '调出组织', width: 160 }
                        , { field: '调入组织', title: '调入组织', width: 160 }
                        , { field: '退料模式', title: '退料模式', width: 160 }
                        , { field: '源单单号', title: '源单单号', width: 160 }
                        , { field: '物料代码', title: '物料代码', width: 160 }
                        , { field: '物料名称', title: '物料名称', width: 160 }
                        , { field: '规格型号', title: '规格型号', width: 160 }
                        , { field: '退回数量', title: '退回数量', width: 160 }
                        , { field: '仓库代码', title: '仓库代码', width: 160 }
                        , { field: '调入仓库', title: '调入仓库', width: 160 }
                        , { field: '调入仓位', title: '调入仓位', width: 160 }
                        , { field: '调出仓库', title: '调出仓库', width: 160 }
                        , { field: '调出仓位', title: '调出仓位', width: 160 }
                        , { field: '责任部门代码', title: '责任部门代码', width: 160 }
                        , { field: '责任部门名称', title: '责任部门名称', width: 160 }
                    ]]
                };
            }
            //选择物料
            function btnMaterial() {
                layer.open({
                    type: 2 //类型
                    , skin: 'layui-layer-rim'//加上边框
                    , area: ['90%', '90%']//大小
                    , title: '物料列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../Baseset/基础资料/Gy_MaterialList.html', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        //获取数据
                        $("#MaterialName").val(checkStatus.data[0].HName);//物料名称
                        $("#MaterialModel").val(checkStatus.data[0].HModel);//物料规格型号
                        $("#MaterialNumber").val(checkStatus.data[0].HNumber);//物料代码
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //选择生产车间
            function btnHDept() {
                layer.open({
                    type: 2 //类型
                    , skin: 'layui-layer-rim'//加上边框
                    , area: ['90%', '90%']//大小
                    , title: '生产车间列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../Baseset/基础资料/Gy_DepartmentList.html', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        //获取数据
                        $("#HDeptName").val(checkStatus.data[0].HName);//部门名称
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //选择工段  æš‚æ— 
            function btnProcMul() {
                layer.open({
                    type: 2 //类型
                    , skin: 'layui-layer-rim'//加上边框
                    , area: ['90%', '90%']//大小
                    , title: '工段列表'//标题
                    , shift: 2//弹出动画
                    //, content: ['../../Baseset/基础资料/Gy_DepartmentList.html', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        //获取数据
                        $("#ProcMul").val(checkStatus.data[0].HName);//工段名称
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //#region é‡ç½®è¿‡æ»¤æ¡ä»¶æ–¹æ³•
            function set_ClearQuery() {
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));//开始日期
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));//结束日期
                $("#HBillNo").val("");//单据号
                $("#HDeptID").val("");//部门
                $("#HBillNo").val("");//报废据号
                $("#MaterialCode").val("");//物料代码
                $("#MaterialName").val("");//物料名称
                $("#SpecificationModel").val("");//规格型号
                $("#Warehouse").val("");//发料仓库
                $("#HSourceBillNo").val("");//源单单号
                $("#Hmaker").val("");//制单人
                $("#MaterialModel").val("");//规格型号
                $("#HDeptName").val("");//生产车间
                $("#ProcMul").val("");//工段
                $("#btnSearch").click();//刷新
                sWhere = "";
@@ -305,52 +381,78 @@
            //#region å¿«é€Ÿè¿‡æ»¤
            function get_FastQuery() {
                var HBeginDate = $("#HBeginDate").val();//开始时间
                var HEndDate = $("#HEndDate").val();//结束时间
                var HBillNo = $("#HBillNo").val();//单据号
                var HDeptID = $("#HDeptID").val();//部门
                var MaterialCode = $("#MaterialCode").val();//物料代码
                var HBeginDate = $("#HBeginDate").val();//退料日期
                var HEndDate = $("#HEndDate").val();//退料结束时间
                var HBillNo = $("#HBillNo").val();//报废单号
                var MaterialNumber = $("#MaterialNumber").val();//物料代码
                var MaterialName = $("#MaterialName").val();//物料名称
                var SpecificationModel = $("#SpecificationModel").val();//规格型号
                var Warehouse = $("#Warehouse").val();//发料仓库
                var HSourceBillNo = $("#HSourceBillNo").val();//源单单号
                var Hmaker = $("#Hmaker").val();//制单人
                var MaterialModel = $("#MaterialModel").val();//规格型号
                var HDeptName = $("#HDeptName").val();//生产车间
                var ProcMul = $("#ProcMul").val();//工段
                var Hmaker = sessionStorage["HUserName"];//当前用户
                var HOrgID = sessionStorage["OrganizationID"];//组织
                var HPZStatus = $("#HPZStatus").val();//品质确认
                var HCKStatus = $("#HCKStatus").val();//仓库接收
                if (HBeginDate) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + HBeginDate + "'";
                sWhere = {
                    HBeginDate: HBeginDate,
                    HEndDate: HEndDate,
                    HBillNo: HBillNo,
                    MaterialNumber: MaterialNumber,
                    MaterialName: MaterialName,
                    MaterialModel: MaterialModel,
                    HDeptName: HDeptName,
                    ProcMul: ProcMul,
                    Hmaker: Hmaker,
                    HOrgID: HOrgID,
                    HPZStatus: HPZStatus,
                    HCKStatus: HCKStatus
                }
                if (HEndDate) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + HEndDate + "'";
                }
                if (HBillNo) {
                    sWhere += " and å•据号 like '%" + HBillNo + "%'";
                }
                if (HDeptID) {
                    sWhere += " and éƒ¨é—¨åç§° like '%" + HDeptID + "%'";
                }
                if (MaterialCode) {
                    sWhere += " and ç‰©æ–™ä»£ç  like '%" + MaterialCode + "%'";
                }
                if (MaterialName) {
                    sWhere += " and ç‰©æ–™åç§° like '%" + MaterialName + "%'";
                }
                if (SpecificationModel) {
                    sWhere += " and è§„格型号 like '%" + SpecificationModel + "%'";
                }
                if (Warehouse) {
                    sWhere += " and è°ƒå…¥ä»“库名称 like '%" + Warehouse + "%'";
                }
                if (HSourceBillNo) {
                    sWhere += " and æºå•单号 like '%" + HSourceBillNo + "%'";
                }
                if (Hmaker) {
                    sWhere += " and åˆ¶å•人 like '%" + Hmaker + "%'";
                }
                get_Display(sWhere);
                get_Display(JSON.stringify(sWhere));
                sWhere = "";//调用接口后清空sWhere缓存
            }
            //#endregion
            //删除
            function set_DeleteBill() {
                var CheckStatus = table.checkStatus("mainTable");
                if (CheckStatus.data.length != 1) {
                    return layer.msg("请选择一条数据!")
                } else {
                    layer.confirm('您确定要删除吗?', {
                        btn: ['确定', '取消'] //按钮
                        , btn1: function () {
                            var HInterID = CheckStatus.data[0].hmainid; //获取编号
                            var HEntryID = CheckStatus.data[0].hsubid; //获取第几条子数据
                            $.ajax({
                                url: GetWEBURL() + '/Cj_CallGoodsBillBack/DelCallGoodsBill'
                                , type: "GET"
                                , data: { "HInterID": HInterID, "HEntryID": HEntryID, "User": sessionStorage["HUserName"] }
                                , success: function (result) {
                                    if (result.count == 1) {
                                        layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                            // å¾—到frame索引
                                            var index = layer.getFrameIndex(window.name);
                                            //关闭当前frame
                                            layer.close(index);
                                            //修改为功后刷新界面
                                            window.location.reload();
                                            ////重载tree
                                            //tree.reload('treeDepartment', {});
                                        });
                                    } else {
                                        layer.alert(result.code + result.Message, { icon: 5 });
                                    }
                                }
                            })
                        }
                    })
                }
            }
            //#endregion
            //以上是layui模块