Example #1
0
 public override BarcodeModel.MODEL.BaseSearchModel Insert()
 {
     string sql = @"
     update WK04 set WK04004=getdate() where WK04001=@wo and WK04002=@wc and WK04004 is null
     ";
     BaseAdo ba = new BaseAdo();
     ba.ExecuteSql(sql,
         new SqlParameter("@wo", this.WorkOrder),
         new SqlParameter("@wc", this.WorkCenter));
     return this;
 }
Example #2
0
 public override BaseSearchModel Insert()
 {
     BaseAdo ba = new BaseAdo();
     StringBuilder sbRights = new StringBuilder("-1");
     foreach (string item in Rights)
     {
         sbRights.Append("," + item);
     }
     string sql = @"delete from UR04 where UR04002=@roleid
     insert into UR04(UR04002,UR04003)
     select @roleid,UR03001 from UR03 where UR03001 in (" + sbRights + ")";
     ba.ExecuteSql(sql, new SqlParameter("@roleid", this.RoleID));
     return this;
 }
Example #3
0
        public override BarcodeModel.MODEL.BaseSearchModel Insert()
        {
            string sql = @"
            declare @bid varchar(30)
            declare @hid int
            declare @i int

            set @i=0
            while @i<@printcount
            begin
            exec PROC_GETID 'RW01',@bid output
            insert into RW02(RW02002,RW02003,RW02004,RW02005,RW02010,RW02011)
            values(@bid,getdate(),@userid,@username,@dj,N'创建条码标签')

            insert into RW01(RW01001,RW01002,RW01003,RW01004,RW01005,RW01006,RW01033,RW01018,RW01024,RW01025,RW01027,RW01032,RW01034,RW01035,RW01037,RW01038,RW01040,RW01041,RW01042,RW01043)
            values(@bid,@stock,@stockname,@stockspec,@unit,@qty,@wo,@remark,@userid,@username,@dj,1,@company,@Batch,@ProductionTime ,@ValidityTime,@tqty,@type,@pagecode,'WO')

            insert into RW04(RW04002,RW04003,RW04004,RW04005) values(getdate(),@dj,@bid,N'创建条码')

            set @i=@i+1
            end
            ";
            ModelAdo<StockModel> adoStock = new ModelAdo<StockModel>();
            StockModel sm = adoStock.GetModelByID(this.StockCode);
            BaseAdo ba = new BaseAdo();
            ba.ExecuteSql(sql, new SqlParameter("@userid", this.LoginUserID),
                new SqlParameter("@username", this.LoginUserName),
                new SqlParameter("@stock", this.StockCode),
                new SqlParameter("@stockname", this.StockName),
                new SqlParameter("@stockspec", this.StockSpec),
                new SqlParameter("@unit", this.Unit),
                new SqlParameter("@qty", this.UnitQty),
                new SqlParameter("@tqty", sm.StockType == "02" ? 1 : sm.UQTY),
                new SqlParameter("@type", sm.StockType),
                new SqlParameter("@wo", this.WorkOrder),
                new SqlParameter("@remark", this.Remark),
                new SqlParameter("@company", this.Company),
                new SqlParameter("@printcount", this.BarcodeQty),
                new SqlParameter("@Batch", this.Batch),
                new SqlParameter("@ProductionTime", this.ProductDate),
                new SqlParameter("@ValidityTime", this.LifeDate),
                new SqlParameter("@pagecode", this.PageCode),
                new SqlParameter("@dj", this.Danju));
            return this;

            /*
            string sql = @"
            declare @dj varchar(30)
            exec PROC_GETID 'FG03',@dj output

            declare @bid varchar(30)
            declare @hid int
            declare @i int

            insert into FG03(FG03001,FG03002,FG03003,FG03004,FG03005,FG03006,FG03007,FG03008)
            values(@dj,getdate(),@userid,@username,'','','',N'创建条码')

            set @i=0
            while @i<@printcount
            begin
            exec PROC_GETID 'FG01',@bid output
            insert into FG02(FG02002,FG02003,FG02004,FG02005,FG02010,FG02011)
            values(@bid,getdate(),@userid,@username,@dj,N'创建条码标签')

            insert into FG01(FG01001,FG01002,FG01003,FG01004,FG01005,FG01006,FG01012,FG01013,FG01014,FG01015,FG01018,FG01024,FG01025,FG01027,FG01032,FG01037,FG01033,FG01034,FG01035,FG01036,FG01038)
            values(@bid,@stock,@stockname,@stockspec,@unit,@qty,'','','','',@remark,@userid,@username,@dj,1,@company,@workorder,@productdate,@lifedate,@pagecode,@lifeday)

            insert into FG04(FG04002,FG04003,FG04004,FG04005) values(getdate(),@dj,@bid,N'创建条码')

            set @i=@i+1
            end
            ";
            BaseAdo ba = new BaseAdo();
            ba.ExecuteSql(sql, new SqlParameter("@userid", this.LoginUserID),
                new SqlParameter("@username", this.LoginUserName),
                new SqlParameter("@workorder", this.WorkOrder),
                new SqlParameter("@stock", this.StockCode),
                new SqlParameter("@stockname", this.StockName),
                new SqlParameter("@stockspec", this.StockSpec),
                new SqlParameter("@unit", this.Unit),
                new SqlParameter("@qty", this.UnitQty),
                new SqlParameter("@remark", this.Remark),
                new SqlParameter("@company", this.Company),
                new SqlParameter("@printcount", this.BarcodeQty),
                new SqlParameter("@productdate", this.ProductDate.ToString("yyyy-MM-dd")),
                new SqlParameter("@lifedate", this.ProductDate.AddDays(this.LifeDate).ToString("yyyy-MM-dd")),
                new SqlParameter("@lifeday", this.LifeDate),
                new SqlParameter("@pagecode", this.PageCode));
            return this;
             * */
        }
Example #4
0
        public override BaseSearchModel Insert()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                string sql = @"
            declare @dj varchar(30)
            exec PROC_GETID 'RW03',@dj output
            --单据头
            insert into RW03(RW03001,RW03002,RW03003,RW03004,RW03005,RW03006,RW03007,RW03008)
            values(@dj,getdate(),@userid,@username,'','','',N'US导入创建条码')
            --装箱标签
            insert into RW07(RW07001,RW07002,RW07003,RW07004,RW07005,RW07006,RW07007,RW07008)
            select RW13017,getdate(),@userid,@username,0,'',0,2 from RW13 where RW13003=@impno and isnull(RW13006,'')<>'' and isnull(RW13017,'')<>'' and isnull(RW13007,'')<>'' and RW13010 not in (select RW01001 from RW01) group by RW13017
            --单据明细
            insert into RW04(RW04002,RW04003,RW04004,RW04005)
            select getdate(),@dj,RW13010,N'US导入创建条码' from RW13 where RW13003=@impno and isnull(RW13006,'')<>'' and isnull(RW13007,'')<>'' and RW13010 not in (select RW01001 from RW01)
            --历史记录
            insert into RW02(RW02002,RW02003,RW02004,RW02005,RW02010,RW02011)
            select RW13010,getdate(),@userid,@username,@dj,N'US导入创建条码' from RW13 where RW13003=@impno and isnull(RW13006,'')<>'' and isnull(RW13007,'')<>'' and RW13010 not in (select RW01001 from RW01)
            --原材料
            insert into RW01(RW01001,RW01002,RW01003,RW01004,RW01005,RW01006,RW01012,RW01013,RW01014,RW01015,RW01024,RW01025,RW01027,RW01031,RW01032,RW01034,RW01035,RW01037,RW01038,RW01041,RW01043,RW01044,RW01045)
            select RW13010,RW13007,RW13008,RW13009,RW13015,RW13014,RW13018,RW13019,RW13005,RW13006,@userid,@username,@dj,RW13017,1,RW13016,RW13011,RW13012,RW13013,RW13022,'PO',RW13020,RW13021
            from RW13 where RW13003=@impno and isnull(RW13006,'')<>'' and isnull(RW13007,'')<>'' and RW13010 not in (select RW01001 from RW01)
            --删除成功的
            delete from RW13 where RW13010 in (select RW01001 from RW01)
            ";
                BaseAdo ba = new BaseAdo();
                ba.ExecuteSql(sql, new SqlParameter("@userid", this.LoginUserID), new SqlParameter("@username", this.LoginUserName), new SqlParameter("@impno", IMPNO));

                ModelAdo<USBarcodeModel> adoUB = new ModelAdo<USBarcodeModel>();
                this.ReturnUSBarcodes = adoUB.GetList("RW13003=@impno", "", "", new SqlParameter("@impno", IMPNO));
                ModelAdo<USBarcodeGroup> adoUBG = new ModelAdo<USBarcodeGroup>();
                this.ReturnUSBarcodeGroups = adoUBG.GetList("RW13003=@impno", "", "", new SqlParameter("@impno", IMPNO));
                ts.Complete();
                return this;
            }
        }
Example #5
0
        public override BarcodeModel.MODEL.BaseSearchModel Insert()
        {
            lock (objLock)
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    BaseAdo ba = new BaseAdo();
                    BaseAdo bascala = new BaseAdo() { ConnectionStr = SysConfig.DBScalaConnection };
                    string sqlpo = @"
            select * from view_poline where PC01001=@po and SC01003=@stockspec and Company=@company
            select * from view_Stock where SC01003=@stockspec and Company=@company
            ";
                    string sql = @"
            insert into RW13(RW13002,RW13003,RW13004,RW13005,RW13006,RW13007,RW13008,RW13009,RW13010,RW13011,RW13012,RW13013,RW13014,RW13015,RW13016,RW13017,RW13018,RW13019,RW13020,RW13021,RW13022)
            values(getdate(),@IMPNO,@userid,@po,@poline,@stockcode,@stockname,@stockspec,@lpn,@supplierbatch,@productdate,@exdate,@qty,@unit,@company,@boxid,@supcode,@supname,@pounit,@saleunit,@stocktype)";

                    string strImport = System.Text.Encoding.ASCII.GetString(this.Bytes);
                    string[] strImportLine = strImport.Replace("\r", " ").Split('\n');
                    IMPNO = Guid.NewGuid().ToString();
                    for (int i = 1; i < strImportLine.Length; i++)
                    {
                        string BarcodeId = "";//导入文件中获取
                        string PackageId = "";//导入文件中获取
                        string StockCode = "";
                        string StockName = "";
                        string StockSpec = "";//导入文件中获取
                        string StockUnit = "";//导入文件中获取
                        string PO = "";//导入文件中获取
                        decimal StockUnitQty = 0;//导入文件中获取
                        string Company = "";//导入文件中获取
                        string SupplierBatch = "";//导入文件中获取
                        string supplierCode = "";
                        string supplierName = "";
                        double purunit = 1;
                        double saleunit = 1;
                        string stockType = "02";
                        string poline = "";
                        DateTime ProductionTime = DateTime.Now;//导入文件中获取
                        DateTime ValidityTime = DateTime.Now;//导入文件中获取

                        string[] strImprotLineItem = strImportLine[i].Split(';');
                        switch (strImprotLineItem[0])
                        {
                            case "11117": Company = "31"; break;
                            case "11116": Company = "32"; break;
                            default: Company = "-"; break;
                        }
                        PO = strImprotLineItem[2];
                        StockSpec = strImprotLineItem[3];
                        PackageId = strImprotLineItem[5];
                        BarcodeId = strImprotLineItem[6];
                        SupplierBatch = strImprotLineItem[7];
                        StockUnitQty = decimal.Parse(strImprotLineItem[10]);
                        DateTime.TryParse(strImprotLineItem[15], out ProductionTime);
                        DateTime.TryParse(strImprotLineItem[16], out ValidityTime);

                        DataSet ds = bascala.GetDataSet(sqlpo, new SqlParameter("@Company", Company), new SqlParameter("@stockspec", StockSpec), new SqlParameter("@po", PO));
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            poline = ds.Tables[0].Rows[0]["PC03002"] + "";
                            supplierCode = ds.Tables[0].Rows[0]["PL01001"] + "";
                            supplierName = ds.Tables[0].Rows[0]["PL01002"] + "";
                        }
                        if (ds.Tables[1].Rows.Count > 0)
                        {
                            double.TryParse(ds.Tables[1].Rows[0]["SC01072"] + "", out purunit);
                            double.TryParse(ds.Tables[1].Rows[0]["SC01073"] + "", out saleunit);
                            stockType = ds.Tables[1].Rows[0]["SC01035"] + "";
                            StockCode = ds.Tables[1].Rows[0]["SC01001"] + "";
                            StockName = ds.Tables[1].Rows[0]["SC01002"] + "";
                            StockUnit = ds.Tables[1].Rows[0]["UNIT"] + "";
                        }
                        ba.ExecuteSql(sql, new SqlParameter("@IMPNO", IMPNO),
                            new SqlParameter("@userid", this.LoginUserID),
                            new SqlParameter("@po", PO),
                            new SqlParameter("@poline", poline),
                            new SqlParameter("@stockcode", StockCode),
                            new SqlParameter("@stockname", StockName),
                            new SqlParameter("@stockspec", StockSpec),
                            new SqlParameter("@lpn", BarcodeId),
                            new SqlParameter("@supplierbatch", SupplierBatch),
                            new SqlParameter("@productdate", ProductionTime),
                            new SqlParameter("@exdate", ValidityTime),
                            new SqlParameter("@qty", StockUnitQty),
                            new SqlParameter("@unit", StockUnit),
                            new SqlParameter("@company", Company),
                            new SqlParameter("@boxid", PackageId),
                            new SqlParameter("@supcode", supplierCode),
                            new SqlParameter("@supname", supplierName),
                            new SqlParameter("@pounit", purunit),
                            new SqlParameter("@saleunit", saleunit),
                            new SqlParameter("@stocktype", stockType));

                    }
                    ModelAdo<USBarcodeModel> adoUB = new ModelAdo<USBarcodeModel>();
                    this.ReturnUSBarcodes = adoUB.GetList("RW13003=@impno", "", "", new SqlParameter("@impno", IMPNO));
                    ModelAdo<USBarcodeGroup> adoUBG = new ModelAdo<USBarcodeGroup>();
                    this.ReturnUSBarcodeGroups = adoUBG.GetList("RW13003=@impno", "", "", new SqlParameter("@impno", IMPNO));
                    ts.Complete();

                }
            }
            return this;
        }
        public override BarcodeModel.MODEL.BaseSearchModel Insert()
        {
            //①:解析获取的文件数据,依据每行来读取。
            //②:替换对应公司,17-31,16-32[[不存在回滚]]
            //③:替换PART_CODE,通过SC01003,找到对应的StockName,StockCode[不存在回滚]
            //④:条码编号:[存在回滚]
            //⑤:是否存在装箱号条码。有:判断装箱条码中是否存在,如果存在:直接并入该装箱号条码。如果不存在:新建
            //⑥:插入原材料:   1:插入,父单据号表;
            //                   2:插入,子单据号明细表;
            //                   3:插入,原材料条码表;
            //                   4:插入,条码历史记录表;

            lock (objLock)
            {

                using (TransactionScope ts = new TransactionScope())
                {
                    try
                    {

                        BaseAdo ba = new BaseAdo();
                        string sql = @"
            declare @billid varchar(30)
            exec PROC_GETID 'RW03',@billid output
            --单据头
            insert into RW03(RW03001,RW03002,RW03003,RW03004,RW03005,RW03006,RW03007,RW03008)
            values(@billid,getdate(),@userid,@username,'','','',N'创建条码')
            select @billid t";
                        DataSet dsBillId = ba.GetDataSet(sql, new SqlParameter("@userid", this.LoginUserID),
                                new SqlParameter("@username", this.LoginUserName));
                        string BillId = ""; //总单据号
                        if (dsBillId != null && dsBillId.Tables[0].Rows.Count > 0)
                        {
                            BillId = dsBillId.Tables[0].Rows[0][0] + "";
                        }

                        string strImport = System.Text.Encoding.ASCII.GetString(this.Bytes);
                        string[] strImportLine = strImport.Replace("\r", " ").Split('\n');
                        for (int i = 1; i < strImportLine.Length; i++)
                        {

                            string BarcodeId = "";//导入文件中获取
                            string PackageId = "";//导入文件中获取
                            string StockCode = "";
                            string StockName = "";
                            string StockSpec = "";//导入文件中获取
                            string StockUnit = "";//导入文件中获取
                            string PO = "";//导入文件中获取
                            decimal StockUnitQty = 0;//导入文件中获取
                            string Company = "";//导入文件中获取
                            string SupplierBatch = "";//导入文件中获取
                            DateTime ProductionTime = DateTime.Now;//导入文件中获取
                            DateTime ValidityTime = DateTime.Now;//导入文件中获取

                            string[] strImprotLineItem = strImportLine[i].Split(';');
                            if (strImprotLineItem[0].Contains("17"))
                            {
                                Company = "31";
                            }
                            else if (strImprotLineItem[0].Contains("16"))
                            {
                                Company = "32";
                            }
                            else
                            {
                                throw new Exception("未找到相对应的公司信息!");
                            }
                            PO = strImprotLineItem[2];
                            StockSpec = strImprotLineItem[3];
                            PackageId = strImprotLineItem[5];
                            BarcodeId = strImprotLineItem[6];
                            SupplierBatch = strImprotLineItem[7];
                            StockUnitQty = decimal.Parse(strImprotLineItem[10]);
                            DateTime.TryParse(strImprotLineItem[15], out ProductionTime);
                            DateTime.TryParse(strImprotLineItem[16], out ValidityTime);

                            ModelAdo<RWBarcodeModel> adoBarcode = new ModelAdo<RWBarcodeModel>();
                            RWBarcodeModel rwModel = adoBarcode.GetModelByID(BarcodeId);
                            if (rwModel != null && rwModel.ID.Length >= 1)
                            {
                                throw new Exception(BarcodeId + "已存在于条码系统中!");
                            }
                            if (!string.IsNullOrEmpty(PackageId))
                            {
                                ModelAdo<PackingModel> adoPackage = new ModelAdo<PackingModel>();
                                PackingModel packageModel = adoPackage.GetModelByID(PackageId);
                                if (packageModel != null)
                                {

                                }
                                else
                                {
                                    string sqlPackage = @"
            --装箱单
            insert into RW07(RW07001,RW07002,RW07003,RW07004,RW07005,RW07006,RW07007,RW07008)
            values(@packageid,getdate(),@userid,@username,0,'',0,2)";
                                    ba.ExecuteSql(sqlPackage, new SqlParameter("packageid", PackageId),
                                            new SqlParameter("@userid", this.LoginUserID),
                                            new SqlParameter("@username", this.LoginUserName));
                                }
                            }

                            ModelAdo<StockModel> adoStock = new ModelAdo<StockModel>();
                            List<StockModel> Stocks = adoStock.GetList("SC01003=@stockspec", "", "", new SqlParameter("@stockspec", StockSpec));
                            if (Stocks != null && Stocks.Count >= 1)
                            {
                                StockCode = Stocks[0].StockCode;
                                StockName = Stocks[0].StockName;
                                StockUnit = Stocks[0].Unit;
                                StockUnitQty = Stocks[0].UQTY;
                            }
                            else
                            {
                                //throw new Exception("未找到相对应的物料信息!");
                                continue;
                            }

                            string barcodeSql = @"
            --单据明细
            insert into RW04(RW04002,RW04003,RW04004,RW04005) values(getdate(),@billid,@barcodeid,N'创建条码')
            --历史记录
            insert into RW02(RW02002,RW02003,RW02004,RW02005,RW02010,RW02011)
            values(@barcodeid,getdate(),@userid,@username,@billid,N'创建条码标签')
            --原材料
            insert into RW01(RW01001,RW01002,RW01003,RW01004,RW01005,RW01006,RW01014,RW01024,RW01025,RW01027,RW01031,RW01032,RW01034,RW01035,RW01037,RW01038,RW01040,RW01041,RW01043)
            values(@barcodeid,@stock,@stockname,@stockspec,@unit,@qty,@po,@userid,@username,@billid,@packageid,1,@company,@supplierbatch,@productiontime ,@validitytime,@tqty,@stype,'PO')
            ";

                            ba.ExecuteSql(barcodeSql, new SqlParameter("@userid", this.LoginUserID),
                                new SqlParameter("@username", this.LoginUserName),
                                new SqlParameter("@stock", StockCode),
                                new SqlParameter("@stockname", StockName),
                                new SqlParameter("@barcodeid", BarcodeId),
                                new SqlParameter("@stockspec", StockSpec),
                                new SqlParameter("@packageid", PackageId),
                                new SqlParameter("@unit", StockUnit),
                                new SqlParameter("@qty", StockUnitQty),
                                new SqlParameter("@tqty", Stocks[0].UQTY),
                                new SqlParameter("@po", PO),
                                new SqlParameter("@stype", Stocks[0].StockType),
                                new SqlParameter("@company", Company),
                                new SqlParameter("@supplierbatch", SupplierBatch),
                                new SqlParameter("@productiontime", ProductionTime),
                                new SqlParameter("@validitytime", ValidityTime),
                                new SqlParameter("@billid", BillId));
                        }
                        ts.Complete();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            return this;
        }
Example #7
0
        /*
        /// <summary>
        /// 创建条码信息
        /// 1:插入,父单据号表;
        /// 2:插入,子单据号明细表;
        /// 3:插入,原材料条码表;
        /// 4:插入,条码历史记录表;
        /// </summary>
        /// <returns></returns>
        public override BaseSearchModel Insert()
        {
            ModelAdo<RWBarcodeModel> adoBarcode = new ModelAdo<RWBarcodeModel>();
            ModelAdo<BillDetailModel> adoBillDetail = new ModelAdo<BillDetailModel>();
            ModelAdo<RWHistoryModel> adoBarcodeHistroy = new ModelAdo<RWHistoryModel>();

            List<RWBarcodeModel> listBarcode = new List<RWBarcodeModel>();
            for (int i = 0; i < BarcodeQTY; i++)
            {

                RWBarcodeModel barcodeModel = new RWBarcodeModel()
                {
                    Bill  = billModel.ID,
                    CompanyCode = this.Company,
                    StockUnit = this.UNITPO,
                    StockCode = this.StockCode,
                    StockName = this.StockName,
                    StockSpec = this.StockSpec,
                    StockUnitQty = this.UNITQTY,
                    SupplierCode = this.SupplierCode,
                    SupplierName = this.SupplierName,
                    Warehouse = this.Warehouse,
                    SO = this.PO,
                    Status = 1,
                    POLine = this.LineNum,
                    WarehouseInTime = DateTime.Now,
                    WarehouseOutTime = DateTime.Now,
                    Remark1 = Remark
                };
                adoBarcode.Insert(barcodeModel);

                listBarcode.Add(barcodeModel);

                BillDetailModel billDetailModel = new BillDetailModel()
                {
                    CreateTime = DateTime.Now,
                    BillID = billModel.ID,
                    BarcodeID = barcodeModel.ID,
                    Remark = billModel.Remark
                };
                adoBillDetail.Insert(billDetailModel);

                RWHistoryModel historyModel = new RWHistoryModel()
                {
                    CreateTime = DateTime.Now,
                    BillID = billModel.ID,
                    BarcodeID = barcodeModel.ID,
                    Remark = billModel.Remark
                };
                adoBarcodeHistroy.Insert(historyModel);

            }
            this.RWBarcodeModels = listBarcode.ToArray();
            return this;
        }
         * */
        public override BarcodeModel.MODEL.BaseSearchModel Insert()
        {
            string sql = @"
            declare @bid varchar(30)
            declare @hid int
            declare @i int

            set @i=0
            while @i<@printcount
            begin
            exec PROC_GETID 'RW01',@bid output
            insert into RW02(RW02002,RW02003,RW02004,RW02005,RW02010,RW02011)
            values(@bid,getdate(),@userid,@username,@dj,N'创建条码标签')

            insert into RW01(RW01001,RW01002,RW01003,RW01004,RW01005,RW01006,RW01012,RW01013,RW01014,RW01015,RW01018,RW01024,RW01025,RW01027,RW01032,RW01034,RW01035,RW01037,RW01038,RW01040,RW01041,RW01043,RW01044,RW01045)
            values(@bid,@stock,@stockname,@stockspec,@unit,@qty,@sup,@supname,@po,@poline,@remark,@userid,@username,@dj,1,@company,@SupplierBatch,@ProductionTime ,@ValidityTime,@tqty,@type,'PO',@unitpur,@unitsale)

            insert into RW04(RW04002,RW04003,RW04004,RW04005) values(getdate(),@dj,@bid,N'创建条码')

            set @i=@i+1
            end
            ";
            ModelAdo<StockModel> adoStock = new ModelAdo<StockModel>();
            StockModel sm = adoStock.GetModelByID(this.StockCode);
            BaseAdo ba = new BaseAdo();
            ba.ExecuteSql(sql, new SqlParameter("@userid", this.LoginUserID),
                new SqlParameter("@username", this.LoginUserName),
                new SqlParameter("@stock", this.StockCode),
                new SqlParameter("@stockname", this.StockName),
                new SqlParameter("@stockspec", this.StockSpec),
                new SqlParameter("@unit", this.UNITWH),
                new SqlParameter("@qty", this.UNITQTY),
                new SqlParameter("@tqty", this.Type == "02" ? 1 : sm.UQTY),
                new SqlParameter("@type", sm.StockType),
                new SqlParameter("@po", this.PO),
                new SqlParameter("@poline", this.LineNum),
                new SqlParameter("@sup", this.SupplierCode),
                new SqlParameter("@supname", this.SupplierName),
                new SqlParameter("@remark", this.Remark),
                new SqlParameter("@company", this.Company),
                new SqlParameter("@SupplierBatch", this.SupplierBatch),
                new SqlParameter("@printcount", this.BarcodeQTY),
                new SqlParameter("@ProductionTime", this.ProductionTime),
                new SqlParameter("@ValidityTime", this.ValidityTime),
                new SqlParameter("@dj", this.Danju),
                new SqlParameter("@unitpur", this.PODivisor),
                new SqlParameter("@unitsale", this.SODivisor));
            return this;
        }