Пример #1
0
        public int GgetSequenceCountupSFT_WS_RUN(string ID)
        {
            string sqlQuerry = "select isnull(max(SEQUENCE),'0')+ 1 from SFT_WS_RUN where ID = '" + ID + "' ";
            sqlSFT sqlSFT    = new sqlSFT();
            string value     = sqlSFT.sqlExecuteScalarString(sqlQuerry);

            if (value != null && value != string.Empty)
            {
                return(int.Parse(value));
            }
            else
            {
                return(0);
            }
        }
        public static double GetPQCStock(string productionOrder)
        {
            double        PQCStock      = 0;
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(" select LOTSIZE from LOT where STATUS = 50 and ERP_OPSEQ = '0020' AND ERP_OPID ='B02'");
            stringBuilder.Append(" AND ID = '" + productionOrder + "' ");
            sqlSFT sqlSFT = new sqlSFT();
            string value  = sqlSFT.sqlExecuteScalarString(stringBuilder.ToString());

            if (value != "")
            {
                PQCStock = double.Parse(value);
            }
            return(PQCStock);
        }
        public void DeleteRowIntoWarehouseEmptyStock(string ID, string status)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select DEFECTQTY from SFT_OP_REALRUN where SEQUENCE = 0 and OPID = 'B02---B01' ");
            builder.Append(" and ID = '" + ID + "' ");
            sqlSFT sFT       = new sqlSFT();
            var    QtyDefect = sFT.sqlExecuteScalarString(builder.ToString());

            if (double.Parse(QtyDefect) == 0)             // Neu con defect thi khong duoc xoa Lot pending warehouse
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(" delete from LOT where 1=1 ");
                stringBuilder.Append(" and ID = '" + ID + "' ");
                stringBuilder.Append(" and STATUS = '" + status + "' ");
                stringBuilder.Append(" and LOTSIZE = '0' ");

                var result = sFT.sqlExecuteNonQuery(stringBuilder.ToString(), false);
            }
        }
Пример #4
0
        public static int GetSequenceInSFT_OP_REALRUN(string ID, string ERP_OPSEQ, string ERP_OPID, string ERP_WSID)
        {
            string        sequence      = "";
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select MAX(SEQUENCE)+1 from SFT_OP_REALRUN where 1=1 ");
            stringBuilder.Append("and ERP_OPSEQ ='" + ERP_OPSEQ + "' ");
            stringBuilder.Append("and ERP_OPID ='" + ERP_OPID + "' ");
            stringBuilder.Append("and ERP_WSID ='" + ERP_WSID + "' ");
            stringBuilder.Append("and ID ='" + ID + "' ");
            sqlSFT sqlSFT = new sqlSFT();

            sequence = sqlSFT.sqlExecuteScalarString(stringBuilder.ToString());
            if (sequence == String.Empty || sequence == "")
            {
                sequence = "1";
                return(1);
            }
            return(int.Parse(sequence));
        }
        public SFT_WIP GetSFT_WIPofProducts(string product)
        {
            SFT_WIP sFT_WIP = new SFT_WIP();

            try
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  sum(LOTSIZE)  from LOT a 
left join MODETAIL b on CMOID = ID
where  ERP_OPSEQ = '0010' and a.STATUS = '0' and b.STATUS !='99' and b.STATUS !='100' 
 ");
                stringBuilder.Append(" and a.ITEMID =  '" + product + "'");
                sqlSFT sqlERPCON = new sqlSFT();
                var    Temp      = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    sFT_WIP.MQC_In_Available = double.Parse(Temp.ToString());
                }
                else
                {
                    sFT_WIP.MQC_In_Available = 0;
                }

                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  sum(LOTSIZE)  from LOT a 
left join MODETAIL b on CMOID = ID
where  ERP_OPSEQ = '0010' and a.STATUS = '50' and b.STATUS !='99' and b.STATUS !='100' 
 ");
                stringBuilder.Append(" and a.ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    sFT_WIP.MQC_Out_Available = double.Parse(Temp.ToString());
                }
                else
                {
                    sFT_WIP.MQC_Out_Available = 0;
                }

                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  sum(LOTSIZE)  from LOT a 
left join MODETAIL b on CMOID = ID
where  ERP_OPSEQ = '0020' and a.STATUS = '0' and b.STATUS !='99' and b.STATUS !='100'
 ");
                stringBuilder.Append(" and a.ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    sFT_WIP.PQC_In_Available = double.Parse(Temp.ToString());
                }
                else
                {
                    sFT_WIP.PQC_In_Available = 0;
                }

                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  sum(LOTSIZE)  from LOT a 
left join MODETAIL b on CMOID = ID
where  ERP_OPSEQ = '0020' and a.STATUS = '50' and b.STATUS !='99' and b.STATUS !='100'
 ");
                stringBuilder.Append(" and a.ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    sFT_WIP.PQC_Out_Available = double.Parse(Temp.ToString());
                }
                else
                {
                    sFT_WIP.PQC_Out_Available = 0;
                }

                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  sum(LOTSIZE)  from LOT a 
left join MODETAIL b on CMOID = ID
where  ERP_OPSEQ = '0020' and a.STATUS = '130' and b.STATUS !='99' and b.STATUS !='100' 
 ");
                stringBuilder.Append(" and a.ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    sFT_WIP.StockIntoWH = double.Parse(Temp.ToString());
                }
                else
                {
                    sFT_WIP.StockIntoWH = 0;
                }
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "GetSFT_WIPofProducts (string product)", ex.Message);
                return(null);
            }
            return(sFT_WIP);
        }
Пример #6
0
        public SFT_WIP GetSFT_WIPofProducts(string product)
        {
            SFT_WIP sFT_WIP = new SFT_WIP();

            try
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  sum(LOTSIZE)  from LOT 
where  ERP_OPSEQ = '0010' and STATUS = '0' 
 ");
                stringBuilder.Append(" and ITEMID =  '" + product + "'");
                sqlSFT sqlERPCON = new sqlSFT();
                var    Temp      = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    sFT_WIP.MQC_In_Available = double.Parse(Temp.ToString());
                }
                else
                {
                    sFT_WIP.MQC_In_Available = 0;
                }

                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  sum(LOTSIZE)  from LOT 
where  ERP_OPSEQ = '0010' and STATUS = '50' 
 ");
                stringBuilder.Append(" and ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    sFT_WIP.MQC_Out_Available = double.Parse(Temp.ToString());
                }
                else
                {
                    sFT_WIP.MQC_Out_Available = 0;
                }

                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  sum(LOTSIZE)  from LOT 
where  ERP_OPSEQ = '0020' and STATUS = '0' 
 ");
                stringBuilder.Append(" and ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    sFT_WIP.PQC_In_Available = double.Parse(Temp.ToString());
                }
                else
                {
                    sFT_WIP.PQC_In_Available = 0;
                }

                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  sum(LOTSIZE)  from LOT 
where  ERP_OPSEQ = '0020' and STATUS = '50' 
 ");
                stringBuilder.Append(" and ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    sFT_WIP.PQC_Out_Available = double.Parse(Temp.ToString());
                }
                else
                {
                    sFT_WIP.PQC_Out_Available = 0;
                }

                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  sum(LOTSIZE)  from LOT 
where  ERP_OPSEQ = '0020' and STATUS = '130' 
 ");
                stringBuilder.Append(" and ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    sFT_WIP.StockIntoWH = double.Parse(Temp.ToString());
                }
                else
                {
                    sFT_WIP.StockIntoWH = 0;
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(sFT_WIP);
        }
        public SemiFinishedGoods GetStockGoodsONSFT(string dept, string product)
        {
            SemiFinishedGoods semiFinished = new SemiFinishedGoods();

            try
            {
                GetStockinINVMC getStockinINVMC  = new GetStockinINVMC();
                var             StockInWarehouse = getStockinINVMC.GetItemsInINVMCs(dept, product);
                if (StockInWarehouse != null)
                {
                    semiFinished.QtyInWarehouse = StockInWarehouse.Select(d => d.Quantity).Sum();
                    semiFinished.QtyWarehouse   = StockInWarehouse.Select(d => d.Quantity).Sum();
                }
                semiFinished.Item = product;
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  isnull(sum(LOTSIZE),'0')  from LOT a 
left join MODETAIL b on CMOID = ID
where  ERP_OPSEQ = '0010' and a.STATUS = '0' and b.STATUS !='99' and b.STATUS !='100' 
 ");
                stringBuilder.Append(" and a.ITEMID =  '" + product + "'");
                sqlSFT sqlERPCON = new sqlSFT();
                var    Temp      = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    semiFinished.QtyInMQC = double.Parse(Temp);
                }
                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  isnull(sum(LOTSIZE),'0')  from LOT a 
left join MODETAIL b on CMOID = ID
where  ERP_OPSEQ = '0010' and a.STATUS = '50' and b.STATUS !='99' and b.STATUS !='100' 
 ");
                stringBuilder.Append(" and a.ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    semiFinished.QtyOutMQC = double.Parse(Temp.ToString());
                }

                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  isnull(sum(LOTSIZE),'0')  from LOT a 
left join MODETAIL b on CMOID = ID
where  ERP_OPSEQ = '0020' and a.STATUS = '0' and b.STATUS !='99' and b.STATUS !='100' 
 ");
                stringBuilder.Append(" and a.ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    semiFinished.QtyInPQC = double.Parse(Temp.ToString());
                }

                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  isnull(sum(LOTSIZE),'0')  from LOT a 
left join MODETAIL b on CMOID = ID
where  ERP_OPSEQ = '0020' and a.STATUS = '50' and b.STATUS !='99' and b.STATUS !='100' 
 ");
                stringBuilder.Append(" and a.ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    semiFinished.QtyOutPQC = double.Parse(Temp.ToString());
                }

                stringBuilder = new StringBuilder();
                stringBuilder.Append(@"select  isnull(sum(LOTSIZE),'0')  from LOT a 
left join MODETAIL b on CMOID = ID
where  ERP_OPSEQ = '0020' and a.STATUS = '130' and b.STATUS !='99' and b.STATUS !='100' 
 ");
                stringBuilder.Append(" and a.ITEMID =  '" + product + "'");
                //  sqlERPCON sqlERPCON = new sqlERPCON();
                Temp = sqlERPCON.sqlExecuteScalarString(stringBuilder.ToString());
                if (Temp != null && Temp != "")
                {
                    semiFinished.QtyPendingWarehouse = double.Parse(Temp.ToString());
                }
                semiFinished.QTyAtMQC = semiFinished.QtyOutMQC;
                semiFinished.QTyAtPQC = semiFinished.QtyInPQC + semiFinished.QtyOutPQC;
                semiFinished.QtyWip   = semiFinished.QTyAtMQC + semiFinished.QTyAtPQC + semiFinished.QtyPendingWarehouse;
                GetAccessory getAccessory = new GetAccessory();
                semiFinished.accessories = getAccessory.GetAccessories(dept, product);
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "GetStockGoodsONSFT(string product) : " + product, ex.Message);
            }
            return(semiFinished);
        }