| | |
| | | } |
| | | |
| | | //获取入库单明细剩余打印数量 |
| | | public string GetAsnDetailQtyList(int id) |
| | | public LabelPrintInfoDto GetAsnDetailQtyList(int id) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | throw new Exception("未查询到入库单明细"); |
| | | } |
| | | var data = new LabelPrintInfoDto(); |
| | | |
| | | var notice = Db.Queryable<BllArrivalNotice>().Where(m => m.IsDel == "0" && m.ASNNo == detail.ASNNo).First(); |
| | | if (notice != null && notice.Type == "4") //判断是否是余料退回单 |
| | | { |
| | | var noticeStr = Db.Queryable<BllArrivalNotice>().Where(m => m.Type == "1").Select(m => m.ASNNo).ToList(); |
| | | var detailOld = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && noticeStr.Contains(m.ASNNo) && m.SkuNo == detail.SkuNo && m.LotNo == detail.LotNo).OrderByDescending(m => m.CreateTime).First(); |
| | | if (detailOld != null) |
| | | { |
| | | var boxInfo = Db.Queryable<BllBoxInfo>().First(m => m.IsDel == "0" && m.ASNNo == detailOld.ASNNo); |
| | | if (boxInfo!= null) |
| | | { |
| | | data.ProductionTime = boxInfo.ProductionTime!= null ? ((DateTime)boxInfo.ProductionTime).ToString("yyyy-MM-dd"):""; |
| | | data.ExpirationTime = boxInfo.ExpirationTime != null ? ((DateTime)boxInfo.ExpirationTime).ToString("yyyy-MM-dd") : ""; |
| | | data.StoreTime = boxInfo.StoreTime != null ? ((DateTime)boxInfo.StoreTime).ToString("yyyy-MM-dd") : ""; |
| | | } |
| | | } |
| | | } |
| | | |
| | | var labelQty = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.ASNDetailNo == id).Sum(m => m.Qty); |
| | | var qty = detail.Qty - labelQty; |
| | | |
| | | return qty.ToString(); |
| | | data.Qty = qty.ToString(); |
| | | return data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | |
| | | //订单回传上游系统 |
| | | public bool FinishAsn(int id, string erpUrl, string mesUrl,string mesTokenUrl, int userId) |
| | | public bool FinishAsn(int id, string erpUrl, string mesUrl,string mesTokenUrl,string userNo,string pwd, int userId) |
| | | { |
| | | try |
| | | { |
| | | var loginPwd = Md5Tools.CalcMd5(pwd); |
| | | var date = Db.Queryable<SysUserInfor>().First(m =>m.IsDel=="0" && m.UserName == userNo && m.PassWord == loginPwd); |
| | | |
| | | if (date == null) //账号密码是否正确 |
| | | { |
| | | throw new Exception("账号密码不正确或没有此账号"); |
| | | } |
| | | if (date.Status != "0") //当前账号是否正常启用 |
| | | { |
| | | throw new Exception("当前账号非启用状态"); |
| | | } |
| | | |
| | | var notice = Db.Queryable<BllArrivalNotice>().First(m => m.Id == id && m.IsDel == "0"); |
| | | if (notice == null) |
| | | { |
| | |
| | | { |
| | | throw new Exception("未查询到单据明细信息"); |
| | | } |
| | | if (userId == notice.UpdateUser) |
| | | if (date.Id == notice.UpdateUser) |
| | | { |
| | | throw new Exception("复核失败,复核人员和关闭订单人员不能相同!"); |
| | | } |
| | |
| | | |
| | | notice.Status = "4"; |
| | | notice.CheckTime = DateTime.Now; |
| | | notice.CheckUser = userId; |
| | | notice.CheckUser = date.Id; |
| | | Db.Updateable(notice).ExecuteCommand(); |
| | | |
| | | new OperationASNServer().AddLogOperationAsn("入库作业", "入库单据", notice.ASNNo, "复核", $"复核了单据号为{notice.ASNNo}的单据信息", userId); |
| | | new OperationASNServer().AddLogOperationAsn("入库作业", "入库单据", notice.ASNNo, "复核", $"{date.RealName}复核了单据号为{notice.ASNNo}的单据信息", userId); |
| | | return true; |
| | | } |
| | | catch (Exception e) |