Administrator
2024-03-04 0acd18b6bebdcfc24a0d7c27edb0f8ef1fc7f9aa
出库单复核功能修改
4个文件已修改
122 ■■■■ 已修改文件
HTML/views/SOSetting/ExportNotice.html 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Wms/Controllers/UpApiController.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/SOSetting/ExportNotice.html
@@ -90,7 +90,7 @@
                                    <option value="3">正在执行</option>
                                    <option value="4">执行完毕</option>
                                    <option value="5">订单关闭</option>
                                    <option value="6">已复核</option>
                                    <option value="6">上传完毕</option>
                                </select>
                            </div>
                        </div>
@@ -362,11 +362,13 @@
                                            </a>`;
                                }                                
                                if( d.Status == '5'){
                                    html += `<a class="layui-btn layui-btn-normal layui-btn-xs shangClass" lay-event="xml">
                                    html += `<a class="layui-btn layui-btn-normal layui-btn-xs checkClass" lay-event="check">
                                        <i class="layui-icon layui-icon-ok"></i>复核
                                    </a>`;
                                }
                                html += `<a class="layui-btn layui-btn-normal layui-btn-xs shangClass" lay-event="xml">
                                    <i class="layui-icon layui-icon-ok"></i>XML
                                </a>`;
                                html += `<a class="layui-btn layui-btn-normal layui-btn-xs editDemoClass" lay-event="editDemo">
                                    <i class="layui-icon layui-icon-edit"></i>备注</a>`;
                                return html;
@@ -1135,7 +1137,7 @@
                            var param = {
                                Id: parseInt(Id), 
                            };
                            sendData(IP + "/UpApi/FinishExportNotice", param, 'post', function(res) {
                            sendData(IP + "/UpApi/CloseExportNotice", param, 'post', function(res) {
                                console.log(res);
                                if (res.code == 0) { //成功
                                    layer.msg(res.msg, {
@@ -1371,6 +1373,29 @@
                                });
                            }
                        }); 
                    }else if(obj.event === 'check'){//复核
                        // 代码区域
                        layer.confirm('确定复核此单据吗?', function(index) {
                            var param = {
                                Id:data.Id,
                            };
                            sendData(IP + "/UpApi/FinishExportNotice", param, 'post', function (res) {
                                if (res.code == 0) { //成功
                                    layer.msg(res.msg, {
                                        icon: 1,
                                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                    }, function () {
                                        refreshTable();
                                        doing = true
                                    });
                                } else { //不成功
                                    layer.msg(res.msg, {
                                        icon: 2,
                                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                                    }, function () { doing = true });
                                }
                            });
                        });
                    }
                });
                
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -972,6 +972,10 @@
                {
                    throw new Exception("未查询到单据信息");
                }
                if (notice.Status != "3")
                {
                    throw new Exception("复核失败,单据非关闭状态");
                }
                var detail = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.ASNNo == notice.ASNNo && m.IsDel == "0").ToList();
                if (detail.Count == 0)
                {
Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -204,10 +204,18 @@
                {
                    throw new Exception("未查询到单据信息");
                }
                if (notice.Status != "5")
                {
                    throw new Exception("复核失败,单据非关闭状态");
                }
                var detail = Db.Queryable<BllExportNoticeDetail>().Where(m => m.SONo == notice.SONo && m.IsDel == "0").ToList();
                if (detail.Count == 0)
                {
                    throw new Exception("未查询到单据明细信息");
                }
                if (userId == notice.UpdateUser)
                {
                    throw new Exception("复核失败,复核人员和关闭订单人员不能相同!");
                }
                var list = new List<SoDetail>();
                foreach (var d in detail)
@@ -225,21 +233,25 @@
                    OrderCode = notice.OrderCode,
                    SoDetails = list
                };
                // 通过接口发送至erp
                var jsonData = JsonConvert.SerializeObject(soInfo);
                #region 通过接口发送至erp
                //系统对接后放开
                /*var jsonData = JsonConvert.SerializeObject(soInfo);
                var response = HttpHelper.DoPost(url, jsonData, "出库单完成上传", "ERP");
                //解析返回数据
                var obj = JsonConvert.DeserializeObject<ErpModel>(response);
                var obj = JsonConvert.DeserializeObject<ErpModel>(response);//解析返回数据
                if (obj.Success != 0)
                {
                    throw new Exception("上传失败" + obj.Message);
                }
                }*/
                #endregion
                notice.Status = "6";
                notice.UpdateTime = DateTime.Now;
                notice.UpdateUser = userId;
                Db.Updateable(notice).ExecuteCommand();
                new OperationSOServer().AddLogOperationSo("出库作业", "出库单据", notice.SONo, "复核", $"复核了单据号为{notice.SONo}的单据信息", userId);
                return true;
            }
            catch (Exception e)
@@ -1047,10 +1059,6 @@
                {
                    throw new Exception("参数异常,请检查状态是否为执行完成或订单关闭/已上传");
                }
                if (userId == notice.UpdateUser)
                {
                    throw new Exception("复核失败,复核人员和关闭订单人员不能相同!");
                }
                //出库单明细
                var comDetail = Db.Queryable<BllCompleteDetail>().Where(m => m.IsDel == "0" && m.SONo == notice.SONo).Select(m => m.BoxNo3).ToList();
                Db.BeginTran();//开启事务
@@ -1065,13 +1073,8 @@
                    //} 
                    var dom = HttpHelper.EncodeParsToFuMa(comDetail, "ceshi", "ExInfoXml");
                    notice.Status = "6";//状态:已上传
                    notice.CheckTime = DateTime.Now;//复核时间
                    notice.CheckUser = userId;//复核人
                    Db.Updateable(notice).ExecuteCommand();
                    ////添加操作日志记录
                     var k = new OperationSOServer().AddLogOperationSo("出库作业", "出库单据", notice.SONo, "复核", $"复核了单据号为{notice.SONo}的单据信息", userId);
                    //var k = new OperationSOServer().AddLogOperationSo("出库作业", "出库单据", notice.SONo, "关单", $"关闭了单据号为{notice.SONo}的单据信息", userId);
                    Db.CommitTran();
                    return dom;
Wms/Wms/Controllers/UpApiController.cs
@@ -97,9 +97,39 @@
                return Ok(new { code = 1, msg = e.Message });
            }
        }
        /// <summary>
        /// 完成出库单据 //出库单关闭反馈
        /// 完成/关闭出库单据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult CloseExportNotice(IdVm model)
        {
            try
            {
                //获取当前登录的用户ID
                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 = "未获取到当前操作人信息" });
                }
                _exNoticeSvc.CloseExportNotice(model.Id, int.Parse(userId));
                return Ok(new { code = 0, count = 0, msg = "出库单关单成功" });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
        }
        /// <summary>
        ///  //出库单复核并上传
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
@@ -119,20 +149,8 @@
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                var bolls = _exNoticeSvc.CloseExportNotice(model.Id, int.Parse(userId));
                if (bolls)
                {
                    //系统对接后放开
                    //var bl =_exNoticeSvc.FinishSo(model.Id,_config.ErpHost + _config.SoFinishUrl, int.Parse(userId));
                    //if (bl)
                    //{
                        return Ok(new { code = 0, count = 0, msg = "出库单关单上传成功" });
                    //}
                    //return Ok(new { code = 1, count = 0, msg = "出库单关单成功但上传失败" });
                }
                return Ok(new { code = 1, msg = "出库单关单失败" });
                _exNoticeSvc.FinishSo(model.Id, _config.ErpHost + _config.SoFinishUrl, int.Parse(userId));
                return Ok(new { code = 0, count = 0, msg = "出库单复核并上传成功" });
            }
            catch (Exception e)
            {