南骏 池
6 天以前 4910c0fa81d93635e19a57c073c3a62c76053320
service/Warehouse/MesInvItemInCDetailsManager.cs
@@ -26,15 +26,15 @@
        var freeze = 0;
        decimal cSyQty = 0;
        //if (string.IsNullOrEmpty(sectionCode))
        //    throw new Exception("请扫库位条码!");
        if (string.IsNullOrEmpty(sectionCode))
            throw new Exception("请扫库位条码!");
        var itemBarcodeDetails = Db.Queryable<MesInvItemBarcodes>()
            .Where(it => it.ItemBarcode == itemBarcode)
            .First();
        //if (itemBarcodeDetails == null)
        //    throw new Exception("条码不存在,请核对!");
        if (itemBarcodeDetails == null)
            throw new Exception("条码不存在,请核对!");
        if (string.IsNullOrEmpty(itemBarcodeDetails.Memo) || itemBarcodeDetails.Memo != "采购入库")
            throw new Exception("此条码不属于到货条码,无法用采购入库!");
@@ -60,6 +60,9 @@
        var cgddDetails = Db.Queryable<MesRohInData>()
            .Where(it => it.EbelnK3id == inventoryDetails.LineK3id)
            .First();
        if (cgddDetails == null)
            throw new Exception("此条码找不到对应采购订单明细!");
        if (inventoryDetails == null)
            throw new Exception("此条码找不到对应收货单明细!");
@@ -87,10 +90,10 @@
        MesDepots mesDepost = null;
        var checkGuid = UtilityHelper.CheckGuid(depotCode);
        if (checkGuid && depotCode2 != null)
        if (checkGuid && depotCode != null)
        {
            mesDepost = Db.Queryable<MesDepots>()
                .Where(s => s.DepotId.ToString() == depotCode2).First();
                .Where(s => s.DepotId.ToString() == depotCode).First();
            // if (depotCode != mesDepost.Guid)
            //     throw new Exception("扫描库位与采购入库库位不一致!");
@@ -245,9 +248,7 @@
                    CreateDate = DateTime.Now,
                    LastupdateBy = user,
                    LastupdateDate = DateTime.Now,
                    UrgentFlag = itemBarcodeDetails.UrgentFlag.Value
                        ? "1"
                        : "0",
                    UrgentFlag = itemBarcodeDetails.UrgentFlag.GetValueOrDefault() ? "1" : "0",
                    CbillNo = itemBarcodeDetails.BillNo,
                    Fstatus = 0,
                    Status = 0,
@@ -298,7 +299,7 @@
                            .Where(it =>
                                it.ItemInId == cId &&
                                    it.ItemId == detail.ItemId &&
                                    it.DepotId == depotCode2 &&
                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                    it.EbelnK3id == detail.EbelnK3id &&
                                    it.LineK3id == detail.LineK3id)
                            .Count();
@@ -327,7 +328,7 @@
                                Remark = itemBarcodeDetails.Memo,
                                EbelnK3id = detail.EbelnK3id,
                                LineK3id = detail.LineK3id,
                                DepotId = depotCode2,
                                DepotId = mesDepost.DepotId.ToString(),
                                itemDabid = itemBarcodeDetails.AboutGuid.ToString()
                            }).IgnoreColumns(true).ExecuteCommand();
                        else
@@ -337,7 +338,7 @@
                                .Where(it =>
                                    it.ItemInId == cId &&
                                    it.ItemId == detail.ItemId &&
                                    it.DepotId == depotCode2 &&
                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                    it.EbelnK3id == detail.EbelnK3id &&
                                    it.LineK3id == detail.LineK3id)
                                .IgnoreColumns(true)
@@ -395,7 +396,7 @@
                            .Where(it =>
                                it.ItemInId == cId &&
                                    it.ItemId == detail.ItemId &&
                                    it.DepotId == depotCode2 &&
                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                    it.EbelnK3id == detail.EbelnK3id &&
                                    it.LineK3id == detail.LineK3id)
                            .Count();
@@ -423,7 +424,7 @@
                                EbelnK3id = detail.EbelnK3id,
                                LineK3id = detail.LineK3id,
                                ItemId = detail.ItemId,
                                DepotId = depotCode2
                                DepotId = mesDepost.DepotId.ToString()
                            }).IgnoreColumns(true).ExecuteCommand();
                        else
                            db.Updateable<MesInvItemInCItems>()
@@ -432,7 +433,7 @@
                                .Where(it =>
                                    it.ItemInId == cId &&
                                    it.ItemId == detail.ItemId &&
                                    it.DepotId == depotCode2 &&
                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                    it.EbelnK3id == detail.EbelnK3id &&
                                    it.LineK3id == detail.LineK3id)
                                .IgnoreColumns(true)
@@ -521,7 +522,7 @@
                    .Where(it =>
                    it.ItemInId == cId &&
                                    it.ItemId == detailone.ItemId &&
                                    it.DepotId == depotCode2 &&
                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                    it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
                    .Count();
@@ -549,7 +550,7 @@
                        EbelnK3id = itemBarcodeDetails.EbelnK3id,
                        LineK3id = itemBarcodeDetails.LineK3id,
                        ItemId = itemBarcodeDetails.ItemId,
                        DepotId = depotCode2,
                        DepotId = mesDepost.DepotId.ToString(),
                        itemDabid = itemBarcodeDetails.AboutGuid.ToString()
                    }).IgnoreColumns(true).ExecuteCommand();
                else
@@ -562,7 +563,7 @@
                        .Where(it =>
                                    it.ItemInId == cId &&
                                    it.ItemId == detailone.ItemId &&
                                    it.DepotId == depotCode2 &&
                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                    it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
                        //.IgnoreColumns(true) // 保留 IgnoreColumns
                        .ExecuteCommand();
@@ -606,7 +607,7 @@
                    CheckRes = inventoryDetails.CheckRes,
                    CheckStates = inventoryDetails.CheckStates,
                    ReceiveOrgId = inventory.ReceiveOrgId,
                    DepotId = Convert.ToInt64(depotCode2)
                    DepotId = Convert.ToInt64(mesDepost.DepotId.ToString())
                }).IgnoreColumns(true).ExecuteCommand();
                // 插入 mes_inv_business2 表
@@ -667,7 +668,7 @@
                LineK3id = itemBarcodeDetails.LineK3id,
                ItemId = itemBarcodeDetails.ItemId,
                BillNo = itemBarcodeDetails.BillNo,
                DepotId = Convert.ToInt32(depotCode2),
                DepotId = Convert.ToInt32(mesDepost.DepotId),
                OwnerId = cgddDetails.DemandOrg,
                OwnerType = owner_type,
                StockOrgId = mesDepost.FSubsidiary,