コード例 #1
0
        public int CreateProductShiftDetail(List <ProductShiftDetailQueryEntity> entity)
        {
            int count = 0;

            if (entity != null && entity.Count > 0)
            {
                string GoldenTaxNo = DateTime.Now.ToString("yyyyMMddHHmmss");
                List <ProductShiftDetailEntity> listProductShiftDetails = DA.GetProductShiftDetail(entity[0]);
                if (listProductShiftDetails.Count > 0)
                {
                    int?StockSysNoA = listProductShiftDetails[0].WarehouseNumber;
                }
                if (listProductShiftDetails.Count > 5000)
                {
                    //throw new BizException("导入数据不能超过5000条!");
                    ThrowBizException("ProductShift_ImportDataCountError");
                }
                count = listProductShiftDetails.Count;
                if (listProductShiftDetails != null && listProductShiftDetails.Count > 0)
                {
                    SetProductShiftDetailGoldenTaxNo(listProductShiftDetails, GoldenTaxNo, entity[0].StockSysNoA);
                    //导入的金税
                    DA.InsertProductShiftDetails(listProductShiftDetails, GoldenTaxNo);
                    //update goldenTaxNo
                    foreach (ProductShiftDetailEntity productshift in listProductShiftDetails)
                    {
                        ExternalDomainBroker.EditGoldenTaxNo(GoldenTaxNo, productshift.StItemSysNo.Value);
                    }

                    string strs = ":";
                    foreach (ProductShiftDetailEntity ent in listProductShiftDetails)
                    {
                        strs += "," + ent.StItemSysNo.Value.ToString();
                    }

                    //record log
                    GoldenTaxInvoiceLogEntity goldenTaxLog = new GoldenTaxInvoiceLogEntity();
                    goldenTaxLog.WarehouseNumber  = entity[0].StockSysNoA;
                    goldenTaxLog.OrderType        = "SHIFT";
                    goldenTaxLog.OrderID          = GoldenTaxNo;
                    goldenTaxLog.LogTime          = DateTime.Now;
                    goldenTaxLog.LogStatus        = 1;
                    goldenTaxLog.LogDescription   = "Insert Golden Tax Successfully" + strs;
                    goldenTaxLog.StoreCompanyCode = entity[0].CompanyCode;
                    goldenTaxLog.LanguageCode     = entity[0].LanguageCode;
                    goldenTaxLog.CompanyCode      = entity[0].CompanyCode;
                    DA.WriteLog(goldenTaxLog);
                }
            }
            else
            {
                //throw new BizException("当前没要导入的金税信息");
                ThrowBizException("ProductShift_ImportDataNotNull");
            }
            return(count);
        }