Exemple #1
0
        public string NewPart(NewPartModel model, SessionInfo epiSession, int StoreInNo, out bool IsSucces, out string msgError)
        {
            int iRunning = RunningPart();
            string PartNum = GetSerialByFormat(iRunning);
            try
            {
                Session currSession = new Session(epiSession.UserID, epiSession.UserPassword, epiSession.AppServer, Session.LicenseType.Default);
                Part myPart = new Part(currSession.ConnectionPool);
                
                PartDataSet dsPart = new PartDataSet();
                myPart.GetNewPart(dsPart);

                DataRow drPart = dsPart.Tables[0].Rows[0];
                drPart.BeginEdit();
                drPart["PartNum"] = PartNum;
                drPart["PartDescription"] = PartNum;
                drPart["UOMClassID"] = "COUNT";
                drPart["IUM"] = "KG";
                drPart["PUM"] = "KG";
                drPart["TypeCode"] = "M";
                drPart["SalesUM"] = "KG";
                drPart["UserChar4"] = model.SupplierCode;
                drPart["UnitPrice"] = model.Amount;
                drPart["Character01"] = model.SaleContract;
                drPart["Character03"] = model.NGRemark;
                drPart["Character07"] = model.ArticleNo;
                drPart["Character07"] = model.CustID;
                drPart["Number10"] = model.Quantity;
                drPart["Date01"] = DateTime.Now;

                drPart["ShortChar01"] = string.IsNullOrEmpty(model.CommodityCode) ? "" : model.CommodityCode;
                drPart["ShortChar02"] = string.IsNullOrEmpty(model.SpecCode) ? "" : model.SpecCode;
                drPart["ShortChar04"] = model.BussinessType;

                drPart["ShortChar05"] = model.MakerCode;
                drPart["ShortChar06"] = model.MillCode;
                drPart["Character07"] = model.ArticleNo;
                drPart["ShortChar08"] = iRunning;
                drPart["ShortChar09"] = model.CoatingCode;

                drPart["Number01"] = model.Thick;
                drPart["Number02"] = model.Width;
                drPart["Number03"] = model.Length;
                drPart["Number11"] = 1;
                drPart["Number12"] = 1;
                if (model.NGStatus == 1)
                {
                    drPart["Character10"] = "N";
                }
                else
                {
                    drPart["Character10"] = "B";
                }

                drPart["NetWeight"] = model.Weight;
                drPart.EndEdit();
                myPart.Update(dsPart);

                currSession.Dispose();

                UpdateStock(PartNum, model.Quantity);
                IsSucces = true;
                msgError = "";
            }
            catch (Exception ex)
            {
                IsSucces = false;
                msgError = ex.Message;
            }
            return PartNum;
        }
Exemple #2
0
        public bool NewPartCollection(NewPartModel model, Session epiSession, out bool IsSucces, out string msgError)
        {
            try
            {
                Part myPart = new Part(epiSession.ConnectionPool);                

                PartDataSet dsPart = new PartDataSet();
                myPart.GetNewPart(dsPart);                

                DataRow drPart = dsPart.Tables[0].Rows[0];
                drPart.BeginEdit();
                drPart["PartNum"] = model.SerialNo;
                drPart["PartDescription"] = model.SerialNo; ;
                drPart["UOMClassID"] = "COUNT";
                drPart["IUM"] = "KG";
                drPart["PUM"] = "KG";
                drPart["TypeCode"] = "M";
                drPart["SalesUM"] = "KG";
                drPart["UserChar4"] = string.IsNullOrEmpty(model.SupplierCode) ? "" : model.SupplierCode;
                drPart["UnitPrice"] = model.Amount;
                drPart["Character01"] = string.IsNullOrEmpty(model.SaleContract) ? "" : model.SaleContract;
                drPart["Character03"] = string.IsNullOrEmpty(model.NGRemark) ? "-" : model.NGRemark;
                drPart["Character07"] = model.ArticleNo;
                drPart["Character07"] = model.CustID;
                drPart["Number10"] = model.Quantity;
                drPart["Date01"] = DateTime.Now;

                drPart["ShortChar01"] = string.IsNullOrEmpty(model.CommodityCode) ? "" : model.CommodityCode;
                drPart["ShortChar02"] = string.IsNullOrEmpty(model.SpecCode) ? "" : model.SpecCode;
                drPart["ShortChar04"] = string.IsNullOrEmpty(model.BussinessType) ? "" : model.BussinessType;

                drPart["ShortChar05"] = string.IsNullOrEmpty(model.MakerCode) ? "" : model.MakerCode;
                drPart["ShortChar06"] = string.IsNullOrEmpty(model.MillCode) ? "" : model.MillCode;
                drPart["Character07"] = string.IsNullOrEmpty(model.ArticleNo) ? "" : model.ArticleNo;
                drPart["Number18"] = model.iRunning;
                drPart["ShortChar09"] = string.IsNullOrEmpty(model.CoatingCode) ? "" : model.CoatingCode;

                drPart["Number01"] = model.Thick;
                drPart["Number02"] = model.Width;
                drPart["Number03"] = model.Length;
                drPart["Number11"] = 1;
                drPart["Number12"] = 1;
                if (model.NGStatus == 1)
                {
                    drPart["Character10"] = "N";
                }
                else
                {
                    drPart["Character10"] = "B";
                }

                drPart["NetWeight"] = model.Weight;
                drPart.EndEdit();
                myPart.Update(dsPart);

                IsSucces = true;
                msgError = "";
            }
            catch (Exception ex)
            {
                IsSucces = false;
                msgError = ex.Message;
            }
            return IsSucces;
        }