| | |
| | | |
| | | if (barcode == null) throw new Exception("条码不存在,请核对!"); |
| | | |
| | | if (barcode.ComeFlg != 3) throw new Exception("条码不是其他入库条码,无法用其他入库!"); |
| | | //if (barcode.ComeFlg != 3) throw new Exception("条码不是其他入库条码,无法用其他入库!"); |
| | | |
| | | // 验证条码是否已在库存中 |
| | | var stockCount = Db.Queryable<MesInvItemStocks>() |
| | |
| | | // 查询是否存在未入库的入库单 |
| | | var existingInv = db.Queryable<MesInvItemIns>() |
| | | .Where(x => x.Status == 0 |
| | | && x.InsDate.Value.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd") |
| | | && x.TransctionNo == transactionNo.ToString() |
| | | && x.CbillNo == p_bill_no |
| | | && x.SuppNo == barcode.SuppNo |
| | | && x.TaskNo == p_bill_no |
| | | //&& x.CbillNo == p_bill_no |
| | | && x.BillTypeId == billTypeId |
| | | && x.DepotsId == Convert.ToInt64(c_depot_id)) |
| | | // && x.DepotsCode == c_depot_code) |
| | | && x.DepotsId == c_depot_id) |
| | | //&& x.SuppNo == barcode.SuppNo) |
| | | .First(); |
| | | |
| | | var newId = Guid.Empty; |
| | |
| | | if (existingInv == null) |
| | | { |
| | | newId = Guid.NewGuid(); |
| | | billNo = BillNo.GetBillNo("INV_IN_OTHER"); |
| | | billNo = BillNo.GetBillNo("QTRK(其他入库单)"); |
| | | |
| | | barcode.UrgentFlag ??= false; |
| | | |
| | |
| | | CreateDate = DateTime.Now, |
| | | LastupdateBy = c_user, |
| | | LastupdateDate = DateTime.Now, |
| | | UrgentFlag = barcode.UrgentFlag.Value ? (byte)1 : (byte)0, |
| | | UrgentFlag = barcode.UrgentFlag.Value ? "1" : "0", |
| | | CbillNo = p_bill_no, |
| | | Fstatus = 0, |
| | | Status = 0, |
| | | Reason = qtrk.Qt010 |
| | | Reason = qtrk.Qt010, |
| | | TaskNo = p_bill_no, |
| | | DepotsId = Convert.ToInt64(c_depot_id) , |
| | | InType = "其他入库" |
| | | |
| | | }).IgnoreColumns(true).ExecuteCommand(); |
| | | } |
| | | else |
| | |
| | | var existingItem = db.Queryable<MesInvItemInCItems>() |
| | | .Where(x => x.ItemInId == newId |
| | | && x.ItemId == barcode.ItemId |
| | | && x.WorkNo == barcode.WorkNo |
| | | && x.WorkLine == barcode.WorkLine) |
| | | && x.DepotId == c_depot_id.ToString() |
| | | ) |
| | | //&& x.DepotCode = |
| | | .First(); |
| | | |
| | | if (existingItem == null) |
| | |
| | | Remark = barcode.Memo, |
| | | EbelnK3id = barcode.EbelnK3id, |
| | | LineK3id = barcode.LineK3id, |
| | | ItemId = barcode.ItemId |
| | | ItemId = barcode.ItemId, |
| | | DepotId = c_depot_id.ToString() |
| | | }).IgnoreColumns(true).ExecuteCommand(); |
| | | else |
| | | // 存在则更新数量 |
| | |
| | | LotNo = barcode.LotNo, |
| | | SuppId = barcode.SuppId, |
| | | SuppNo = barcode.SuppNo, |
| | | DepotId = c_depot_id, |
| | | DepotId = Convert.ToInt64(c_depot_id), |
| | | DepotCode = c_depot_code, |
| | | DepotSectionCode = p_section_code, |
| | | ItemSname = barcode.ItemSname, |
| | |
| | | // 更新申请单明细已入库数量 |
| | | res += db.Updateable<MesItemQtrrDetail>() |
| | | .SetColumns(x => x.Qd008 == (x.Qd008 ?? 0) + barcode.Quantity) |
| | | .Where(x => x.Guid == barcode.Guid) |
| | | .Where(x => x.QtrkGuid == qtrk.Guid && |
| | | x.ItemId == barcode.ItemId.ToString()) |
| | | .ExecuteCommand(); |
| | | |
| | | // 检查是否完全入库并更新状态 |