コード例 #1
0
 public bool CheckExstinctRow(string ID, string ERP_OPSEQ, string ERP_OPID, string ERP_WSID)
 {
     try
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.Append(" select * from SFT_OP_REALRUN ");
         stringBuilder.Append(" where 1=1 ");
         stringBuilder.Append(" and ID ='" + ID + "' ");
         stringBuilder.Append(" and ERP_OPSEQ ='" + ERP_OPSEQ + "' ");
         stringBuilder.Append(" and ERP_OPID ='" + ERP_OPID + "' ");
         stringBuilder.Append(" and ERP_WSID ='" + ERP_WSID + "' ");
         stringBuilder.Append(" and REPORTSTOCKIN ='" + 1 + "' ");
         sqlSFT    sqlSFT = new sqlSFT();
         DataTable dt     = new DataTable();
         sqlSFT.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
         if (dt.Rows.Count > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         SystemLog.Output(SystemLog.MSG_TYPE.Err, "CheckExtinctRow(string Table, string ID, string ID2)", ex.Message);
         return(false);
     }
 }
コード例 #2
0
        public List <DeptCodeName> deptCodeNames(ref ComboBox comboBox)
        {
            comboBox.Items.Clear();
            List <DeptCodeName> deptCodes = new List <DeptCodeName>();
            StringBuilder       sql       = new StringBuilder();

            sql.Append("select MD001,MD002 ");
            sql.Append("from dbo.ERP_CMSMD ");
            sql.Append("where 1=1 ");
            sqlSFT    sqlSFT = new sqlSFT();
            DataTable dt     = new DataTable();

            sqlSFT.sqlDataAdapterFillDatatable(sql.ToString(), ref dt);
            deptCodes = (from DataRow dr in dt.Rows
                         select new DeptCodeName()
            {
                DeptCode = dr["MD001"].ToString(),
                DeptName = "[" + dr["MD001"].ToString() + "] - " + dr["MD002"].ToString()
            }).ToList();

            foreach (var item in deptCodes)
            {
                comboBox.Items.Add(item.DeptName);
            }

            return(deptCodes);
        }
コード例 #3
0
 public bool CheckExstinctRow(string producCode, string Status, string ERP_OPSEQ)
 {
     try
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.Append(" select * from LOT ");
         stringBuilder.Append(" where 1=1 ");
         stringBuilder.Append(" and ID = '" + producCode + "' ");
         stringBuilder.Append(" and STATUS = '" + Status + "' ");
         stringBuilder.Append(" and ERP_OPSEQ ='" + ERP_OPSEQ + "' ");
         sqlSFT    sqlSFT = new sqlSFT();
         DataTable dt     = new DataTable();
         sqlSFT.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
         if (dt.Rows.Count > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         SystemLog.Output(SystemLog.MSG_TYPE.Err, "CheckExtinctRow(string Table, string ID, string ID2)", ex.Message);
         return(false);
     }
 }
コード例 #4
0
 public bool UpdateMODETAIL(DataTable dtTRansOrderLine)
 {
     try
     {
         for (int i = 0; i < dtTRansOrderLine.Rows.Count; i++)
         {
             string        PO            = dtTRansOrderLine.Rows[i]["KEYID"].ToString();
             DataTable     dtLot         = Database.SFT.SFT_LOT.GetDataTableLot(PO);
             StringBuilder stringBuilder = new StringBuilder();
             stringBuilder.Append(" update MODETAIL ");
             stringBuilder.Append(" set LASTMAINTAINDATETIME = GETDATE() , ");
             stringBuilder.Append("  MO009 = MO009 +" + dtTRansOrderLine.Rows[i]["TRANSQTY"] + ", ");
             stringBuilder.Append("  MO033 = '" + DateTime.Now.ToString("yyyyMMdd") + "' , ");
             stringBuilder.Append("  MO027 = MO027 + " + double.Parse(dtTRansOrderLine.Rows[i]["TRANSQTY"].ToString()) * double.Parse(dtLot.Rows[0]["PKQTYPER"].ToString()) + " ");
             stringBuilder.Append("where CMOID ='" + dtTRansOrderLine.Rows[i]["KEYID"] + "' ");
             sqlSFT sqlSFT = new sqlSFT();
             var    result = sqlSFT.sqlExecuteNonQuery(stringBuilder.ToString(), false);
             if (result == false)
             {
                 return(false);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         SystemLog.Output(SystemLog.MSG_TYPE.Err, "UpdateMODETAIL(FinishedGoodsItems fgItems)", ex.Message);
     }
     return(false);
 }
コード例 #5
0
        public DataTable GetTop1DataTable()
        {
            DataTable dt     = new DataTable();
            string    querry = "select top(1) * from SFT_TRANSORDER ";
            sqlSFT    sqlSFT = new sqlSFT();

            sqlSFT.sqlDataAdapterFillDatatable(querry, ref dt);
            return(dt);
        }
        public DataTable GetDataTableFromLot()
        {
            DataTable     dt            = new DataTable();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(" select top(1) * from LOT ");
            sqlSFT sqlSFT = new sqlSFT();

            sqlSFT.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
            return(dt);
        }
コード例 #7
0
        public static DataTable GetDataTableSFT_OP_REALRUN()
        {
            DataTable     dt            = new DataTable();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select top(1) * from SFT_OP_REALRUN ");
            sqlSFT sqlSFT = new sqlSFT();

            sqlSFT.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
            return(dt);
        }
コード例 #8
0
        public static DataTable GetDataTableLot(string ProductOrder)
        {
            DataTable     dt            = new DataTable();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select top(1) * from LOT where  ID ='" + ProductOrder + "' ");
            sqlSFT sqlSFT = new sqlSFT();

            sqlSFT.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
            return(dt);
        }
コード例 #9
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);
            }
        }
コード例 #10
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 DataTable GetDataTableLOTMODETAIL(string productCode)
        {
            DataTable     dt            = new DataTable();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(@"select  *  from LOT a 
 left join MODETAIL b on CMOID = ID
 where  1 = 1
 and ERP_OPSEQ = '0020'
 and a.STATUS = '130'
 and b.STATUS != '99' and b.STATUS != '100'
");
            stringBuilder.Append(" and a.ID= '" + productCode + "'");
            sqlSFT sqlSFT = new sqlSFT();

            sqlSFT.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
            return(dt);
        }
コード例 #12
0
        public static string getProductionOrder(string Product)
        {
            DataTable     dt = new DataTable();
            string        productionOrder = "";
            StringBuilder stringBuilder   = new StringBuilder();

            stringBuilder.Append(@" select ID from LOT where LOTSIZE > 0  and STATUS = 50
and ERP_OPSEQ ='0020' ");
            stringBuilder.Append(" and ITEMID like  '%" + Product + "%' ");

            sqlSFT sqlSFT = new sqlSFT();

            sqlSFT.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
            if (dt.Rows.Count > 0)
            {
                productionOrder = dt.Rows[0]["ID"].ToString();
            }
            return(productionOrder);
        }
コード例 #13
0
        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);
            }
        }
コード例 #14
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));
        }
コード例 #15
0
        public bool UpdateLotforFinishedGood(DataRow dtTRansOrderLine, string Status, string ERP_OPSEQ)
        {
            try
            {
                string    PO    = dtTRansOrderLine["KEYID"].ToString().Trim();
                DataTable dtLot = Database.SFT.SFT_LOT.GetDataTableLot(PO);

                StringBuilder stringBuilder = new StringBuilder();

                stringBuilder.Append("update LOT set");
                if (Status == "99")
                {
                    stringBuilder.Append("  LOTSIZE =LOTSIZE + " + dtTRansOrderLine["TRANSQTY"] + ", ");
                    stringBuilder.Append("  PKQTY = PKQTY + " + double.Parse(dtTRansOrderLine["TRANSQTY"].ToString()) * double.Parse(dtLot.Rows[0]["PKQTYPER"].ToString()) + " ");
                    stringBuilder.Append(" where ID  ='" + dtTRansOrderLine["KEYID"] + "' and STATUS =99");
                    //stringBuilder.Append(" and ERP_OPSEQ ='" + ERP_OPSEQ + "' ");
                }
                else if (Status == "130")
                {
                    stringBuilder.Append("  LOTSIZE =LOTSIZE - " + dtTRansOrderLine["TRANSQTY"] + ", ");
                    stringBuilder.Append("  PKQTY = PKQTY - " + double.Parse(dtTRansOrderLine["TRANSQTY"].ToString()) * double.Parse(dtLot.Rows[0]["PKQTYPER"].ToString()) + " ");
                    stringBuilder.Append(" where ID  ='" + dtTRansOrderLine["KEYID"] + "' and STATUS =130");
                    stringBuilder.Append(" and ERP_OPSEQ ='" + ERP_OPSEQ + "' ");
                }

                sqlSFT sqlSFT = new sqlSFT();
                var    result = sqlSFT.sqlExecuteNonQuery(stringBuilder.ToString(), false);
                if (result == false)
                {
                    return(false);
                }


                return(true);
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "UpdateLotforFinishedGood(FinishedGoodsItems fgItems, string Status)", ex.Message);
            }
            return(false);
        }
コード例 #16
0
        public List <PendingWarehouseItems> GetFinishedGoodsItems(string product)
        {
            List <PendingWarehouseItems> pendingWarehouseItems = new List <PendingWarehouseItems>();

            try
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(@" select  a.ID, a.ITEMID,LOTSIZE, a.UNIT,a.PKQTYPER, a.ERP_WSID,a.ERP_OPID   from LOT a 
 left join MODETAIL b on CMOID = ID
 where  1 = 1
 and ERP_OPSEQ = '0020'
 and a.STATUS = '130'
 and b.STATUS != '99' and b.STATUS != '100' ");
                stringBuilder.Append(" and a.ITEMID LIKE '%" + product + "%' ");
                DataTable dt       = new DataTable();
                sqlSFT    sqlTLVN2 = new sqlSFT();
                sqlTLVN2.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    pendingWarehouseItems.Add(new PendingWarehouseItems
                    {
                        ProductCode = dt.Rows[i]["ID"].ToString(),
                        product     = dt.Rows[i]["ITEMID"].ToString(),
                        TotalQty    = dt.Rows[i]["LOTSIZE"].ToString() != "" ? double.Parse(dt.Rows[i]["LOTSIZE"].ToString()) : 0,
                        DefectQty   = 0,
                        Unit        = dt.Rows[i]["UNIT"].ToString(),
                        DateExport  = DateTime.Now,
                        PKQTYPER    = double.Parse(dt.Rows[i]["PKQTYPER"].ToString()),
                        OUTDEPID    = dt.Rows[i]["ERP_WSID"].ToString(),
                        OUTTYPE     = dt.Rows[i]["ERP_OPID"].ToString()
                    });
                }
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "GetFinishedGoodsItems(string product)", ex.Message);
            }
            return(pendingWarehouseItems);
        }
コード例 #17
0
        public List <DeptCodeName> deptCodeNames()
        {
            List <DeptCodeName> deptCodes = new List <DeptCodeName>();
            StringBuilder       sql       = new StringBuilder();

            sql.Append("select MD001,MD002 ");
            sql.Append("from dbo.ERP_CMSMD ");
            sql.Append("where 1=1 ");
            sqlSFT    sqlSFT = new sqlSFT();
            DataTable dt     = new DataTable();

            sqlSFT.sqlDataAdapterFillDatatable(sql.ToString(), ref dt);
            deptCodes = (from DataRow dr in dt.Rows
                         select new DeptCodeName()
            {
                DeptCode = dr["MD001"].ToString(),
                DeptName = "[" + dr["MD001"].ToString() + "] - " + dr["MD002"].ToString()
            }).ToList();



            return(deptCodes);
        }
コード例 #18
0
        public bool UpdateOPREALRUN(string ID, string ERP_OPSEQ, string ERP_OPID, string ERP_WSID, DataRow dtERPPQC)
        {
            try
            {
                string        PO            = dtERPPQC["ProductOrder"].ToString();
                DataTable     dtLot         = Database.SFT.SFT_LOT.GetDataTableLot(PO);
                StringBuilder stringBuilder = new StringBuilder();

                stringBuilder.Append("update SFT_OP_REALRUN set ");
                stringBuilder.Append(" OUTQTY = OUTQTY +" + dtERPPQC["Quantity"] + ", ");
                stringBuilder.Append(" PKQTY = PKQTY +" + double.Parse(dtERPPQC["Quantity"].ToString()) * double.Parse(dtLot.Rows[0]["PKQTYPER"].ToString()) + ", ");
                stringBuilder.Append(" OR023 = OR023 -" + double.Parse(dtERPPQC["Quantity"].ToString()) * double.Parse(dtLot.Rows[0]["PKQTYPER"].ToString()) + ", ");
                stringBuilder.Append(" OUTTIME = '" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "' ");
                stringBuilder.Append(" where ID ='" + ID + "' ");
                stringBuilder.Append(" and ERP_OPSEQ ='" + ERP_OPSEQ + "' ");
                stringBuilder.Append(" and ERP_OPID ='" + ERP_OPID + "' ");
                stringBuilder.Append(" and ERP_WSID ='" + ERP_WSID + "' ");
                stringBuilder.Append(" and SEQUENCE ='" + 0 + "' ");
                sqlSFT sqlSFT = new sqlSFT();
                var    update = sqlSFT.sqlExecuteNonQuery(stringBuilder.ToString(), false);
                if (update == false)
                {
                    SystemLog.Output(SystemLog.MSG_TYPE.Err, "UpdateOPREALRUN", "False");
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "UpdateOPREALRUN", ex.Message);
            }

            return(false);
        }
コード例 #19
0
        public bool InsertData(DataTable dtdata, out int[] sequence)

        {
            int[] sequencUpdate = new int[dtdata.Rows.Count];
            try
            {
                StringBuilder stringBuilder = new StringBuilder();

                stringBuilder.Append(" insert into SFT_WS_RUN ( ");
                for (int i = 0; i < dtdata.Columns.Count; i++)
                {
                    if (i < dtdata.Columns.Count - 1)
                    {
                        stringBuilder.Append(dtdata.Columns[i].ColumnName + ",");
                    }
                    else
                    {
                        stringBuilder.Append(dtdata.Columns[i].ColumnName + ") values ( ");
                    }
                }
                for (int i = 0; i < dtdata.Rows.Count; i++)
                {
                    string ID = dtdata.Rows[i]["ID"].ToString();
                    int    _SequenceUpdate = GgetSequenceCountupSFT_WS_RUN(ID);
                    sequencUpdate[i]           = _SequenceUpdate;
                    dtdata.Rows[i]["SEQUENCE"] = _SequenceUpdate;
                    StringBuilder stringFun = new StringBuilder();
                    for (int j = 0; j < dtdata.Columns.Count; j++)
                    {
                        string valueCell = "NULL";

                        if (dtdata.Rows[i][dtdata.Columns[j].ColumnName] != null)
                        {
                            if (dtdata.Columns[j].DataType == typeof(DateTime))
                            {
                                if (dtdata.Columns[j].ColumnName == "MODI_DATE")
                                {
                                    valueCell = "NULL";
                                }
                                else
                                {
                                    valueCell = DateTime.Now.ToString("yyyyMMdd HH:mm:ss");
                                }
                            }
                            else if (dtdata.Rows[i][dtdata.Columns[j].ColumnName].GetType() == typeof(DBNull))
                            {
                                valueCell = "NULL";
                            }
                            else
                            {
                                valueCell = dtdata.Rows[i][dtdata.Columns[j].ColumnName].ToString();
                            }
                        }

                        if (j < dtdata.Columns.Count - 1)
                        {
                            if (valueCell == "NULL")
                            {
                                stringFun.Append(" " + valueCell + " ,");
                            }
                            else
                            {
                                stringFun.Append(" '" + valueCell + "',");
                            }
                        }
                        else
                        {
                            if (valueCell == "NULL")
                            {
                                stringFun.Append(" " + valueCell + ")");
                            }
                            else
                            {
                                stringFun.Append(" '" + valueCell + "')");
                            }
                        }
                    }
                    string sqlInsert = stringBuilder.ToString() + stringFun.ToString();
                    sqlSFT sqlSFT    = new sqlSFT();
                    var    result    = sqlSFT.sqlExecuteNonQuery(sqlInsert, false);

                    if (result == false)
                    {
                        sequence = sequencUpdate;
                        return(false);
                    }
                }
                sequence = sequencUpdate;
                return(true);
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "SFT_TRANSORDER_LINE", ex.Message);
            }
            sequence = sequencUpdate;
            return(false);
        }
コード例 #20
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 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);
        }
コード例 #21
0
        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);
        }
コード例 #22
0
        public bool InsertData(DataTable dtdata)

        {
            try
            {
                StringBuilder stringBuilder = new StringBuilder();

                stringBuilder.Append(" insert into LOT ( ");
                for (int i = 0; i < dtdata.Columns.Count; i++)
                {
                    if (i < dtdata.Columns.Count - 1)
                    {
                        stringBuilder.Append(dtdata.Columns[i].ColumnName + ",");
                    }
                    else
                    {
                        stringBuilder.Append(dtdata.Columns[i].ColumnName + ") values ( ");
                    }
                }
                for (int i = 0; i < dtdata.Rows.Count; i++)
                {
                    StringBuilder stringFun = new StringBuilder();
                    for (int j = 0; j < dtdata.Columns.Count; j++)
                    {
                        string valueCell = "NULL";

                        if (dtdata.Rows[i][dtdata.Columns[j].ColumnName] != null)
                        {
                            if (dtdata.Columns[j].DataType == typeof(DateTime))
                            {
                                valueCell = "NULL";
                            }
                            else if (dtdata.Rows[i][dtdata.Columns[j].ColumnName].GetType() == typeof(DBNull))
                            {
                                valueCell = "NULL";
                            }
                            else
                            {
                                valueCell = dtdata.Rows[i][dtdata.Columns[j].ColumnName].ToString();
                            }
                        }
                        if (j < dtdata.Columns.Count - 1)
                        {
                            if (valueCell == "NULL")
                            {
                                stringFun.Append(" " + valueCell + " ,");
                            }
                            else
                            {
                                stringFun.Append(" '" + valueCell + "',");
                            }
                        }
                        else
                        {
                            if (valueCell == "NULL")
                            {
                                stringFun.Append(" " + valueCell + ")");
                            }
                            else
                            {
                                stringFun.Append(" '" + valueCell + "')");
                            }
                        }
                    }
                    string sqlInsert = stringBuilder.ToString() + stringFun.ToString();
                    sqlSFT sqlSFT    = new sqlSFT();
                    var    result    = sqlSFT.sqlExecuteNonQuery(sqlInsert, false);
                    if (result == false)
                    {
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "SFT_TRANSORDER_LINE", ex.Message);
            }
            return(false);
        }
コード例 #23
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);
        }