| | |
| | | { |
| | | 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) |
| | |
| | | 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) |
| | |
| | | { |
| | | 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();//开启事务 |
| | |
| | | //} |
| | | |
| | | 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; |