Пример #1
0
        public static void BatchSend2DMS_Async(IList<SupplySource> lstErpData, int actionType)
        {
            if (lstErpData != null
                && lstErpData.Count > 0
                )
            {
                DMSAsync_PI06.PI06Client service = PubExtend.GetPI06Async();

                System.Collections.Generic.List<DMSAsync_PI06.partBaseDto> lines = new System.Collections.Generic.List<DMSAsync_PI06.partBaseDto>();
                foreach (SupplySource supplierItem in lstErpData)
                {
                    DMSAsync_PI06.partBaseDto linedto = new DMSAsync_PI06.partBaseDto();
                    if (supplierItem.OriginalData.SupplierInfo != null && supplierItem.OriginalData.SupplierInfo.SupplierKey != null)
                    {
                        linedto.suptCode = supplierItem.OriginalData.SupplierInfo.Supplier.Code;
                    }
                    if (supplierItem.OriginalData.ItemInfo != null && supplierItem.OriginalData.ItemInfo.ItemIDKey != null)
                    {
                        linedto.partCode = supplierItem.OriginalData.ItemInfo.ItemID.Code;
                        linedto.partName = supplierItem.OriginalData.ItemInfo.ItemID.Name;
                    }
                    if (supplierItem.OriginalData.ItemInfo.ItemID.InventoryUOM != null)
                    {
                        linedto.unit = supplierItem.OriginalData.ItemInfo.ItemID.InventoryUOM.Name;
                    }
                    if (supplierItem.OriginalData.ItemInfo.ItemID.PurchaseInfo != null)
                    {
                        linedto.miniPack = ((supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1);
                    }
                    //SalePriceLine line = SalePriceLine.Finder.Find(string.Format("SalePriceList.Org={0} and ItemInfo.ItemID={1} and Active=1 and '{2}' between FromDate and ToDate", Context.LoginOrg.ID.ToString(), supplierItem.OriginalData.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]);
                    SalePriceLine line = PubHelper.GetSalePriceList(supplierItem);
                    if (line != null)
                    {
                        linedto.salePrice = float.Parse(line.Price.ToString());
                        linedto.unitPrace = linedto.salePrice;
                    }
                    else
                    {
                        linedto.salePrice = 0f;
                        linedto.unitPrace = 0f;
                    }
                    linedto.isFlag = "2";
                    linedto.isDanger = "0";
                    linedto.isReturn = "1";
                    linedto.isSale = "1";
                    linedto.isEffective = supplierItem.OriginalData.Effective.IsEffective.ToString();
                    linedto.actionType = actionType;
                    lines.Add(linedto);
                }

                // service.Do(lines);

                try
                {
                    PubExtend.Do(service, lines.ToArray());
                }
                catch (System.Exception e)
                {
                    throw new System.ApplicationException("调用DMS接口错误:" + e.Message);
                }
            }
        }
Пример #2
0
        public static void BatchSend2DMS_Async(IList<SalePriceLine> lstErpData, int actionType)
        {
            if (lstErpData != null
                && lstErpData.Count > 0
                )
            {
                DMSAsync_PI06.PI06Client service = PubExtend.GetPI06Async();

                System.Collections.Generic.List<DMSAsync_PI06.partBaseDto> lines = new System.Collections.Generic.List<DMSAsync_PI06.partBaseDto>();
                foreach (SalePriceLine line in lstErpData)
                {
                    if (line.Active && System.DateTime.Now >= line.FromDate && (System.DateTime.Now < line.ToDate || line.ToDate.ToString() == "9999.12.31"))
                    {
                        SupplySource.EntityList supitemlist = SupplySource.Finder.FindAll(string.Format("Org={0} and ItemInfo.ItemID={1} and Effective.IsEffective=1 and '{2}' between Effective.EffectiveDate and Effective.DisableDate", Context.LoginOrg.ID.ToString(), line.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()));
                        if (supitemlist != null && supitemlist.Count > 0)
                        {
                            foreach (SupplySource i in supitemlist)
                            {
                                DMSAsync_PI06.partBaseDto linedto = new DMSAsync_PI06.partBaseDto();
                                linedto.suptCode = i.SupplierInfo.Supplier.Code;
                                linedto.partCode = line.ItemInfo.ItemID.Code;
                                linedto.partName = line.ItemInfo.ItemID.Name;
                                if (line.ItemInfo.ItemID.InventoryUOM != null)
                                {
                                    linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name;
                                }
                                if (line.ItemInfo.ItemID.PurchaseInfo != null)
                                {
                                    linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1);
                                }
                                linedto.salePrice = float.Parse(line.Price.ToString());
                                linedto.unitPrace = linedto.salePrice;
                                linedto.isDanger = "0";
                                linedto.isReturn = "1";
                                linedto.isSale = "1";
                                linedto.isFlag = "1";
                                linedto.isEffective = line.Active.ToString();
                                linedto.actionType = 1;
                                lines.Add(linedto);
                            }
                        }
                        else
                        {
                            DMSAsync_PI06.partBaseDto linedto = new DMSAsync_PI06.partBaseDto();
                            linedto.partCode = line.ItemInfo.ItemID.Code;
                            linedto.partName = line.ItemInfo.ItemID.Name;
                            if (line.ItemInfo.ItemID.InventoryUOM != null)
                            {
                                linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name;
                            }
                            if (line.ItemInfo.ItemID.PurchaseInfo != null)
                            {
                                linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1);
                            }
                            linedto.salePrice = float.Parse(line.Price.ToString());
                            linedto.unitPrace = linedto.salePrice;
                            linedto.isDanger = "0";
                            linedto.isReturn = "1";
                            linedto.isSale = "1";
                            linedto.isFlag = "1";
                            linedto.isEffective = line.Active.ToString();
                            linedto.actionType = 1;
                            lines.Add(linedto);
                        }
                    }
                }

                // service.Do(lines);

                try
                {
                    PubExtend.Do(service, lines.ToArray());
                }
                catch (System.Exception e)
                {
                    throw new System.ApplicationException("调用DMS接口错误:" + e.Message);
                }
            }
        }