public override BaseSearchModel Insert()
        {
            if (Barcodes == null || Barcodes.Length == 0)
                throw new Exception("请扫描或输入待销毁的条码标签");
            using (TransactionScope ts = new TransactionScope())
            {

                ModelAdo<RWBarcodeModel> adoRW = new ModelAdo<RWBarcodeModel>();
                StringBuilder sb = new StringBuilder();
                foreach (string item in Barcodes)
                {
                    sb.Append(",'" + item + "'");
                }
                sb.Remove(0, 1);

                string sql = @"
            declare @RC int
            declare @result nvarchar(200)
            declare @dj varchar(30)
            set @RC=0
            set @result=N'YES'

            if @result='YES'
            begin

            insert into RW02(RW02002,RW02003,RW02004,RW02005,RW02011)
            select RW01001,getdate(),@userid,@username,@Remark from RW01 where RW01001 IN ([BIDS])

            update RW01 set RW01024=@userid,RW01025=@username,RW01032=5 where RW01001 IN ([BIDS])
            end
            select @result MSG
            ";
                sql = sql.Replace("[BIDS]", sb.ToString());
                DataSet ds = adoRW.GetDataSet(sql, new SqlParameter("@Remark", this.Remark), new SqlParameter("@userid", this.LoginUserID), new SqlParameter("@username", this.LoginUserName));
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    string msg = ds.Tables[0].Rows[0][0] + "";
                    if (msg != "YES")
                        throw new Exception(msg);
                    else if (this.isExportFile)
                    {
                        this.ExportXML(sb.ToString());
                    }
                }
                ts.Complete();
                return this;
            }
        }
Beispiel #2
0
 /// <summary>
 /// 通过录入数据,获取提示PO订单号码
 /// </summary>
 /// <returns></returns>
 public override BaseSearchModel GetModelByID(string id)
 {
     ModelAdo<WOLineModel> modelAdo = new ModelAdo<WOLineModel>();
     List<string> pos = new List<string>();
     string strSql = "select top  10  T.MP64001 as WO   from (select distinct(MP64001) from view_WO where  charindex(@tips,MP64001)>0 ) T";
     DataSet ds = modelAdo.GetDataSet(strSql, new SqlParameter("@tips", id));
     if (ds != null && ds.Tables[0].Rows.Count > 0)
     {
         string[] rs = new string[ds.Tables[0].Rows.Count];
         for (int i = 0; i < rs.Length; i++)
         {
             rs[i] = ds.Tables[0].Rows[i][0] + "";
         }
         this.WOS = rs;
     }
     return this;
 }
Beispiel #3
0
        public override BaseSearchModel Insert()
        {
            if (Barcodes == null || Barcodes.Length == 0)
                throw new Exception("请扫描或输入待入库的条码标签");
            using (TransactionScope ts = new TransactionScope())
            {

                ModelAdo<FGBarcodeModel> adoRW = new ModelAdo<FGBarcodeModel>();
                StringBuilder sb = new StringBuilder();
                foreach (string item in Barcodes)
                {
                    sb.Append(",'" + item + "'");
                }
                sb.Remove(0, 1);

                string sql = @"
            declare @RC int
            declare @result nvarchar(200)
            declare @dj varchar(30)
            set @RC=0
            set @result=N'YES'

            if @result='YES'
            begin
            exec PROC_GETID 'FG03',@dj output

            insert into FG02(FG02002,FG02003,FG02004,FG02005,FG02010,FG02011)
            select FG01001,getdate(),@userid,@username,@dj,N'装箱到'+@PackingID from FG01 where FG01001 IN ([BIDS])

            update FG01 set FG01024=@userid,FG01025=@username,FG01031=@PackingID where FG01001 IN ([BIDS])
            update FG07 set FG07008=@Status where FG07001 =@PackingID
            end
            select @result MSG
            ";
                sql = sql.Replace("[BIDS]", sb.ToString());
                DataSet ds = adoRW.GetDataSet(sql, new SqlParameter("@PackingID", this.PackingID), new SqlParameter("@userid", this.LoginUserID), new SqlParameter("@username", this.LoginUserName), new SqlParameter("@Status", this.Status));
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    string msg = ds.Tables[0].Rows[0][0] + "";
                    if (msg != "YES")
                        throw new Exception(msg);
                }
                ts.Complete();
                return this;
            }
        }
Beispiel #4
0
 /// <summary>
 ///  通过录入数据,获取提示PO订单号码
 /// </summary>
 /// <returns></returns>
 public override BarcodeModel.MODEL.BaseSearchModel Insert()
 {
     ModelAdo<POLineModel> modelAdo = new ModelAdo<POLineModel>();
     List<string> pos = new List<string>();
     string strSql = "select top  10  T.PC01001 as PO   from (select distinct(PC01001) from view_poline where Company=@company and  charindex(@tips,PC01001)>0) T";
     DataSet ds = modelAdo.GetDataSet(strSql, new SqlParameter("@company", company), new SqlParameter("@tips", tips));
     if (ds != null && ds.Tables[0].Rows.Count > 0)
     {
         string[] rs = new string[ds.Tables[0].Rows.Count];
         for (int i = 0; i < rs.Length; i++)
         {
             rs[i] = ds.Tables[0].Rows[i][0] + "";
         }
         this.POS = rs;
     }
     return this;
 }
Beispiel #5
0
        public override BaseSearchModel Insert()
        {
            if (Barcodes == null || Barcodes.Length == 0)
                throw new Exception("请扫描或输入待入库的条码标签");
            ModelAdo<LocationModel> adoLoc = new ModelAdo<LocationModel>();
            List<LocationModel> lm = adoLoc.GetList("SC36001=@wh and SC36002=@bin", "", "", new SqlParameter("@wh", this.Warehouse), new SqlParameter("@bin", this.Bin));

            if (lm.Count == 0)
                throw new Exception("仓库或库位不存在");
            using (TransactionScope ts = new TransactionScope())
            {

                ModelAdo<FGBarcodeModel> adoRW = new ModelAdo<FGBarcodeModel>();
                StringBuilder sb = new StringBuilder();
                foreach (string item in Barcodes)
                {
                    sb.Append(",'" + item + "'");
                }
                sb.Remove(0, 1);

                string sql = @"
            declare @RC int
            declare @result nvarchar(200)
            declare @dj varchar(30)
            set @RC=0
            set @result=N'YES'
            select @RC=count(FG01001) from FG01 where FG01001 IN ([BIDS]) and FG01032>1
            if @RC>0
            begin
            set @result=N'不能对已入库的料进行入库操作'
            end
            set @RC=0
            select @RC=count(distinct(FG01033)) from FG01 where FG01001 IN ([BIDS])
            if @RC>1
            begin
            set @result=N'请对同一工单号进行入库操作'
            end
            if @result='YES'
            begin
            exec PROC_GETID 'FG03',@dj output

            insert into FG03(FG03001,FG03002,FG03003,FG03004,FG03005,FG03006,FG03007,FG03008)
            values(@dj,getdate(),@userid,@username,'','','',@Remark)

            insert into FG02(FG02002,FG02003,FG02004,FG02005,FG02010,FG02011)
            select FG01001,getdate(),@userid,@username,@dj,N'入库到'+@whstr from FG01 where FG01001 IN ([BIDS])

            insert into FG04(FG04002,FG04003,FG04004,FG04005)
            select getdate(),@dj,FG01001,N'入库到'+@whstr from FG01 where FG01001 IN ([BIDS])

            update FG01 set FG01008=@wh,FG01009=@sh,FG01010=getdate(),FG01024=@userid,FG01025=@username,FG01027=@dj,FG01032=2 where FG01001 IN ([BIDS])
            end
            select @result MSG
            ";
                sql = sql.Replace("[BIDS]", sb.ToString());
                DataSet ds = adoRW.GetDataSet(sql, new SqlParameter("@Remark", this.Remark), new SqlParameter("@userid", this.LoginUserID), new SqlParameter("@username", this.LoginUserName),
                    new SqlParameter("@wh", this.Warehouse), new SqlParameter("@sh", this.Bin), new SqlParameter("@whstr", this.Warehouse + "[" + this.Bin + "]"));
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    string msg = ds.Tables[0].Rows[0][0] + "";
                    if (msg != "YES")
                        throw new Exception(msg);
                    else
                    {
                        this.ExportXML(sb.ToString());
                    }
                }
                ts.Complete();
                return this;
            }
        }
Beispiel #6
0
        public override BarcodeModel.MODEL.BaseSearchModel Insert()
        {
            if (Barcodes == null || Barcodes.Length == 0)
                throw new Exception("请扫描或输入待入库的条码标签");

            //①:修改成品发货单单FG08状态 :FG08008	int		状态(1已申请 2部分发货 3关闭)
            //②:修改成品发货单单ITEMFG09已领和剩余数量
            //③:插入FG10	成品发货单单BARCODE	中间表

            //④:修改条码信息表:
            //⑤:插入FG03成品单据表
            //⑥:插入FG04成品单据明细表
            //⑦:插入FG02	成品历史记录
            using (TransactionScope ts = new TransactionScope())
            {
                ModelAdo<FGBarcodeModel> adoFG = new ModelAdo<FGBarcodeModel>();
                List<SqlParameter> parameters = new List<SqlParameter>();
                StringBuilder sb = new StringBuilder();
                foreach (string item in Barcodes)
                {
                    sb.Append(",'" + item + "'");
                }
                sb.Remove(0, 1);

                string sql = @"
            declare @RC int
            declare @lineno varchar(10)
            declare @result nvarchar(200)
            declare @dj varchar(30)
            set @RC=0
            set @result=N'YES'
            select @RC=count(FG01001) from FG01 where FG01001 IN ([BIDS]) and FG01032 <> 2
            if @RC>0
            begin
            set @result=N'存在不能做发货操作的信息,不能进行发货操作'
            end

            if @result='YES'
            begin

            Update FG09 set FG09005=@userid,FG09006=@username,FG09011=@InvoicedCount, FG09012=@InvoiceSurplusCount where FG09001=@InvoiceLine

            select @lineno=FG09002 from FG09 where FG09001=@InvoiceLine

            declare @calcstatus int
            set @calcstatus=2
            select @calcstatus=SUM(FG09012) from FG09 where FG09003=@InvoiceID
            if @calcstatus>0
            begin
            set @InvoiceStatus=2
            end
            else
            begin
            set @InvoiceStatus=3
            end
            Update FG08 set FG08008=@InvoiceStatus where FG08001=@InvoiceID

            insert into FG10(FG10002,FG10003,FG10004,FG10005,FG10006,FG10007)
            select getdate(),@userid,@username,@InvoiceID,@InvoiceLine,FG01001 from FG01 where FG01001 IN ([BIDS])

            exec PROC_GETID 'FG03',@dj output

            insert into FG03(FG03001,FG03002,FG03003,FG03004,FG03005,FG03006,FG03007,FG03008)
            values(@dj,getdate(),@userid,@username,'','',@InvoiceID,@Remark)

            insert into FG02(FG02002,FG02003,FG02004,FG02005,FG02010,FG02011)
            select FG01001,getdate(),@userid,@username,@dj,N'发货单['+ @InvoiceID +']' from FG01 where FG01001 IN ([BIDS])

            insert into FG04(FG04002,FG04003,FG04004,FG04005)
            select getdate(),@dj,FG01001,N'发货单['+ @InvoiceID +']' from FG01 where FG01001 IN ([BIDS])

            update FG01 set FG01016 =FG01008 ,FG01017 = FG01009,FG01024=@userid,FG01025=@username,FG01027=@dj,FG01032=3,FG01030=@InvoiceID,FG01039=@lineno where FG01001 IN ([BIDS])

            end
            select @result MSG
            ";

                parameters.Add(new SqlParameter("@userid", this.LoginUserID));
                parameters.Add(new SqlParameter("@username", this.LoginUserName));
                parameters.Add(new SqlParameter("@Remark", this.Remark));
                parameters.Add(new SqlParameter("@InvoiceID", this.InvoiceID));
                parameters.Add(new SqlParameter("@InvoiceStatus", this.InvoiceStatus));
                parameters.Add(new SqlParameter("@InvoiceLine", this.InvoiceLine));
                parameters.Add(new SqlParameter("@InvoicedCount", this.InvoicedCount));
                parameters.Add(new SqlParameter("@InvoiceSurplusCount", this.InvoiceSurplusCount));

                sql = sql.Replace("[BIDS]", sb.ToString());
                DataSet ds = adoFG.GetDataSet(sql, parameters.ToArray());
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    string msg = ds.Tables[0].Rows[0][0] + "";
                    if (msg != "YES")
                        throw new Exception(msg);
                    else
                    {
                        this.ExportXML(sb.ToString());
                    }
                }
                ts.Complete();
                return this;
            }
        }
        public override BarcodeModel.MODEL.BaseSearchModel Insert()
        {
            if (Barcodes == null || Barcodes.Length == 0)
                throw new Exception("请扫描或输入待入库的条码标签");
            ModelAdo<LocationModel> adoLoc = new ModelAdo<LocationModel>();
            List<LocationModel> lm = adoLoc.GetList("SC36001=@wh and SC36002=@bin", "", "", new SqlParameter("@wh", this.Warehouse), new SqlParameter("@bin", this.Bin));

            if (lm.Count == 0)
                throw new Exception("仓库或库位不存在");

            //①:修改原材料领料单RW08状态 :RW08008	int		状态(1已申请 2部分发货 3关闭)
            //②:修改原材料领料单ITEMRW09已领和剩余数量
            //③:插入RW10	原材料领料单BARCODE	中间表

            //④:修改条码信息表:
            //⑤:插入RW03原材料单据表
            //⑥:插入RW04原材料单据明细表
            //⑦:插入RW02	原材料历史记录
            using (TransactionScope ts = new TransactionScope())
            {
                ModelAdo<RWBarcodeModel> adoRW = new ModelAdo<RWBarcodeModel>();
                List<SqlParameter> parameters = new List<SqlParameter>();
                StringBuilder sb = new StringBuilder();
                foreach (string item in Barcodes)
                {
                    sb.Append(",'" + item + "'");
                }
                sb.Remove(0, 1);

                string sql = @"
            declare @RC int
            declare @result nvarchar(200)
            declare @dj varchar(30)
            set @RC=0
            set @result=N'YES'
            select @RC=count(RW01001) from RW01 where RW01001 IN ([BIDS]) and RW01032 <> 2
            if @RC>0
            begin
            set @result=N'存在不能做领料操作的信息,不能进行领料操作'
            end

            if @result='YES'
            begin
            declare @calcstatus int

            Update RW09 set RW09005=@userid,RW09006=@username,RW09011=@ReceivedCount, RW09012=@ReceiveSurplusCount where RW09001=@ReceiveLine

            set @calcstatus=2
            select @calcstatus=SUM(RW09012) from RW09 where RW09003=@ReceiveID
            if @calcstatus>0
            begin
            set @ReceiveStatus=2
            end
            else
            begin
            set @ReceiveStatus=3
            end

            Update RW08 set RW08008=@ReceiveStatus where RW08001=@ReceiveID

            insert into RW10(RW10002,RW10003,RW10004,RW10005,RW10006,RW10007)
            select getdate(),@userid,@username,@ReceiveID,@ReceiveLine,RW01001 from RW01 where RW01001 IN ([BIDS])

            exec PROC_GETID 'RW03',@dj output

            insert into RW03(RW03001,RW03002,RW03003,RW03004,RW03005,RW03006,RW03007,RW03008)
            values(@dj,getdate(),@userid,@username,'','',@ReceiveID,@Remark)

            insert into RW02(RW02002,RW02003,RW02004,RW02005,RW02010,RW02011)
            select RW01001,getdate(),@userid,@username,@dj,N'领料单['+ @ReceiveID +'];移库到'+@whstr from RW01 where RW01001 IN ([BIDS])

            insert into RW04(RW04002,RW04003,RW04004,RW04005)
            select getdate(),@dj,RW01001,N'领料单['+ @ReceiveID +']; 移库到'+@whstr from RW01 where RW01001 IN ([BIDS])

            update RW01 set RW01016 =RW01008 ,RW01017 = RW01009,RW01008=@wh,RW01009=@sh,RW01024=@userid,RW01025=@username,RW01027=@dj,RW01032=3 where RW01001 IN ([BIDS])

            end
            select @result MSG
            ";

                parameters.Add(new SqlParameter("@userid", this.LoginUserID));
                parameters.Add(new SqlParameter("@username", this.LoginUserName));
                parameters.Add(new SqlParameter("@Remark", this.Remark));
                parameters.Add(new SqlParameter("@ReceiveID", this.ReceiveID));
                parameters.Add(new SqlParameter("@ReceiveStatus", this.ReceiveStatus));
                parameters.Add(new SqlParameter("@ReceiveLine", this.ReceiveLine));
                parameters.Add(new SqlParameter("@ReceivedCount", this.ReceivedCount));
                parameters.Add(new SqlParameter("@ReceiveSurplusCount", this.ReceiveSurplusCount));

                parameters.Add(new SqlParameter("@wh", this.Warehouse));
                parameters.Add(new SqlParameter("@sh", this.Bin));
                parameters.Add(new SqlParameter("@whstr", this.Warehouse + "[" + this.Bin + "]"));

                sql = sql.Replace("[BIDS]", sb.ToString());
                DataSet ds = adoRW.GetDataSet(sql, parameters.ToArray());
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    string msg = ds.Tables[0].Rows[0][0] + "";
                    if (msg != "YES")
                        throw new Exception(msg);
                    else
                    {
                        this.ExportXML(sb.ToString());
                    }
                }
                ts.Complete();
                return this;
            }
        }
        public override BaseSearchModel Insert()
        {
            if (Barcodes == null || Barcodes.Length == 0)
                throw new Exception("请扫描或输入待入库的条码标签");
            ModelAdo<LocationModel> adoLoc = new ModelAdo<LocationModel>();
            List<LocationModel> lm = adoLoc.GetList("SC36001=@wh and SC36002=@bin", "", "", new SqlParameter("@wh", this.Warehouse), new SqlParameter("@bin", this.Bin));

            if (lm.Count == 0)
                throw new Exception("仓库或库位不存在");
            using (TransactionScope ts = new TransactionScope())
            {

                ModelAdo<RWBarcodeModel> adoRW = new ModelAdo<RWBarcodeModel>();
                StringBuilder sb = new StringBuilder();
                foreach (string item in Barcodes)
                {
                    sb.Append(",'" + item + "'");
                }
                sb.Remove(0, 1);

                string sql = @"
            declare @RC int
            declare @result nvarchar(200)
            declare @dj varchar(30)
            set @RC=0
            set @result=N'YES'
            select @RC=count(RW01001) from RW01 where RW01001 IN ([BIDS]) and RW01032>1
            if @RC>0
            begin
            set @result=N'已入库的料不可再入库'
            end
            set @RC=0
            select @RC=count(distinct(RW01014)) from RW01 where RW01001 IN ([BIDS])
            if @RC>1
            begin
            set @result=N'多张采购单请分批收货'
            end
            set @RC=0
            select @RC=count(distinct(RW01043)) from RW01 where RW01001 IN ([BIDS])
            if @RC>1
            begin
            set @result=N'PO收货、WO收货以及STOCK RECEIVE请分开操作'
            end
            if @result='YES'
            begin
            exec PROC_GETID 'RW03',@dj output

            insert into RW03(RW03001,RW03002,RW03003,RW03004,RW03005,RW03006,RW03007,RW03008)
            values(@dj,getdate(),@userid,@username,'','','',@Remark)

            insert into RW02(RW02002,RW02003,RW02004,RW02005,RW02010,RW02011)
            select RW01001,getdate(),@userid,@username,@dj,N'入库到'+@whstr from RW01 where RW01001 IN ([BIDS])

            insert into RW04(RW04002,RW04003,RW04004,RW04005)
            select getdate(),@dj,RW01001,N'入库到'+@whstr from RW01 where RW01001 IN ([BIDS])

            update RW01 set RW01008=@wh,RW01009=@sh,RW01010=getdate(),RW01024=@userid,RW01025=@username,RW01027=@dj,RW01032=2 where RW01001 IN ([BIDS])

            UPDATE WK01 SET WK01006=getdate() where WK01006 is null and WK01004<= (select sum(RW01006) FROM RW01 WHERE RW01032=2 and RW01033=WK01001 and RW01002=WK01002 GROUP BY RW01033,RW01002)
            end
            select @result MSG
            ";
                sql = sql.Replace("[BIDS]", sb.ToString());
                DataSet ds = adoRW.GetDataSet(sql, new SqlParameter("@Remark", this.Remark), new SqlParameter("@userid", this.LoginUserID), new SqlParameter("@username", this.LoginUserName),
                    new SqlParameter("@wh", this.Warehouse), new SqlParameter("@sh", this.Bin), new SqlParameter("@whstr", this.Warehouse + "[" + this.Bin + "]"));
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    string msg = ds.Tables[0].Rows[0][0] + "";
                    if (msg != "YES")
                        throw new Exception(msg);
                    else
                    {
                        this.ExportXMLPO(sb.ToString());
                    }
                }
                ts.Complete();
                return this;
            }
        }