예제 #1
0
        private string generateOnhandNo()
        {
            ONHAND_D pair;
            var      prefixRules = "";
            var      runningNo   = "";

            using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
            {
                try
                {
                    List <sanm1> sanm1 = db.Select <sanm1>("SELECT Prefix, NextNo FROM sanm1 WHERE NumberType = 'OMOH'");

                    prefixRules = Modfunction.CheckNull(sanm1[0].Prefix);
                    runningNo   = Modfunction.CheckNull(sanm1[0].NextNo);
                    pair        = generateTransactionNo(prefixRules, runningNo);
                    string strSql = "";
                    strSql = "NextNo=" + Modfunction.SQLSafeValue(pair.NextNo) + "";
                    db.Update("sanm1",
                              strSql,
                              "numbertype='OMOH' ");
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return(pair.TrxNo);
        }
예제 #2
0
파일: Saal.cs 프로젝트: sysmagicapp/OnHand
        public int Update_Saal(Saal request)
        {
            int Result    = -1;
            int intResult = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
                {
                    if (request.PrimaryKeyLineItemNo > 0)
                    {
                        intResult = db.Scalar <int>(
                            "Select Max(lineItemNo) from saal1 where Tablename = {0} AND PrimaryKeyName = {1} AND PrimaryKeyValue = {2} and PrimaryKeyLineItemNo = {3}",
                            request.TableName, request.PrimaryKeyName, request.PrimaryKeyValue, request.PrimaryKeyLineItemNo
                            );
                        if (request.TableName == "Imgr2" || request.TableName == "Imgi2")
                        {
                            db.ExecuteSql("Update " + request.TableName + " Set " + request.FieldName +
                                          " = " + Modfunction.SQLSafeValue(request.NewValue) + " Where TrxNo = " +
                                          Modfunction.SQLSafeValue(request.PrimaryKeyValue) + " AND LineItemNo = " +
                                          Modfunction.SQLSafeValue(request.PrimaryKeyLineItemNo.ToString()));
                        }
                    }
                    else
                    {
                        intResult = db.Scalar <int>(
                            "Select Max(lineItemNo) from saal1 where Tablename = {0} AND PrimaryKeyName = {1} AND PrimaryKeyValue = {2} ",
                            request.TableName, request.PrimaryKeyName, request.PrimaryKeyValue
                            );
                    }
                    if (intResult > 0)
                    {
                        intResult = intResult + 1;
                    }
                    else
                    {
                        intResult = 1;
                    }
                    if (request.PrimaryKeyLineItemNo > 0)
                    {
                        db.ExecuteSql("insert into saal1 (Tablename, PrimaryKeyName, PrimaryKeyValue,PrimaryKeyLineItemNo ,LineItemNo, FieldName, NewValue, OldValue) values ('" +
                                      Modfunction.SQLSafe(request.TableName) + "','" + Modfunction.SQLSafe(request.PrimaryKeyName) + "'," + Modfunction.SQLSafeValue(request.PrimaryKeyValue) + "," + Modfunction.SQLSafeValue(request.PrimaryKeyLineItemNo.ToString()) + "," + intResult.ToString() + ",'" +
                                      Modfunction.SQLSafe(request.FieldName) + "'," + Modfunction.SQLSafeValue(request.NewValue) + "," + Modfunction.SQLSafeValue(request.OldValue) + ")");
                    }
                    else
                    {
                        db.ExecuteSql("insert into saal1 (Tablename, PrimaryKeyName, PrimaryKeyValue,PrimaryKeyLineItemNo ,LineItemNo, FieldName, NewValue, OldValue) values ('" +
                                      Modfunction.SQLSafe(request.TableName) + "','" + Modfunction.SQLSafe(request.PrimaryKeyName) + "'," + Modfunction.SQLSafeValue(request.PrimaryKeyValue) + "," + Modfunction.SQLSafeValue(request.PrimaryKeyLineItemNo.ToString()) + "," + intResult.ToString() + ",'" +
                                      Modfunction.SQLSafe(request.FieldName) + "'," + Modfunction.SQLSafeValue(request.NewValue) + "," + Modfunction.SQLSafeValue(request.OldValue) + ")");
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #3
0
        public object Get_Impm1_Transfer_List(Impm request)
        {
            List <Impm1_Transfer_Tree> ResultTrees = new List <Impm1_Transfer_Tree>();
            List <Impm1_Transfer>      Results     = null;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
                {
                    if ((request.WarehouseCode != null && request.WarehouseCode != "") && (request.StoreNo != null && request.StoreNo != ""))
                    {
                        string strSql = "Select Impm1.TrxNo, Impm1.BatchLineItemNo, IsNull(ProductCode,'') AS name, IsNull(ProductCode,'') AS ProductCode," +
                                        "IsNull(ProductName,'') AS ProductName, IsNull(GoodsReceiveorIssueNo,'') AS GoodsReceiveorIssueNo, IsNull(UserDefine1,'') AS UserDefine1," +
                                        "b.QtyBal, '' AS FromToStoreNo, 0 AS ScanQty , '' as TreeLineItemNo ,''objectTrxNo  " +
                                        "From Impm1 Join (Select (Select top 1 Imit1.StatusCode from imit1 Where imit1.GoodsTransferNoteNo = a.GoodsReceiveorIssueNo) AS ImitStatus, a.TrxNo, " +
                                        "(CASE a.DimensionFlag When '1' THEN a.BalancePackingQty When '2' THEN a.BalanceWholeQty ELSE a.BalanceLooseQty END) AS QtyBal From Impm1 a ) b on b.TrxNo = impm1.TrxNo " +
                                        "Where WarehouseCode='" + request.WarehouseCode + "' And ( impm1.TrxType =1 or impm1.TrxType =3) And StoreNo='" + request.StoreNo + "' And (b.ImitStatus = 'EXE' or ImitStatus is null) And b.QtyBal>0  ";
                        if (request.CustomerCode != null && request.CustomerCode != "")
                        {
                            strSql = strSql + " AND CustomerCode = " + Modfunction.SQLSafeValue(request.CustomerCode);
                        }
                        strSql  = strSql + " order by impm1.ProductCode ";
                        Results = db.Select <Impm1_Transfer>(strSql);
                        for (int i = 0; i < Results.Count; i++)
                        {
                            string         BatchNo         = Results[i].name;
                            Impm1_Transfer impm1           = Results[i];
                            bool           blnExistBatchNo = false;
                            foreach (Impm1_Transfer_Tree ResultTree in ResultTrees)
                            {
                                if (ResultTree.name.Equals(BatchNo))
                                {
                                    blnExistBatchNo      = true;
                                    impm1.TreeLineItemNo = ResultTree.tree.Count;
                                    impm1.objectTrxNo    = ResultTree.tree[0].objectTrxNo;
                                    ResultTree.tree.Add(impm1);
                                }
                            }
                            if (!blnExistBatchNo)
                            {
                                Impm1_Transfer_Tree impm1_tree = new Impm1_Transfer_Tree();
                                impm1_tree.name      = BatchNo;
                                impm1_tree.tree      = new List <Impm1_Transfer>();
                                impm1.TreeLineItemNo = 0;
                                impm1.objectTrxNo    = ResultTrees.Count;
                                impm1_tree.tree.Add(impm1);
                                ResultTrees.Add(impm1_tree);
                            }
                        }
                    }
                }
            }
            catch { throw; }
            return(ResultTrees);
        }
예제 #4
0
파일: Smar.cs 프로젝트: sysmagicapp/yogaApp
        public int Comfirm_Smar1(Smar request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection())
                {
                    if (request.UpdateAllString != null && request.UpdateAllString != "")
                    {
                        JArray ja = (JArray)JsonConvert.DeserializeObject(request.UpdateAllString);
                        if (ja != null)
                        {
                            for (int i = 0; i < ja.Count(); i++)
                            {
                                string strSql         = "";
                                string PhoneNumber    = ja[i]["PhoneNumber"].ToString();
                                string PassWord       = ja[i]["PassWord"].ToString();
                                string YogaStudioName = ja[i]["YogaStudioName"].ToString();
                                string Sex            = ja[i]["Sex"].ToString();
                                string Remark         = ja[i]["Remark"].ToString();
                                string AreaCode       = ja[i]["AreaCode"].ToString();

                                strSql = "insert into Samr1( " +
                                         "   YogaStudioName," +
                                         "   AreaCode," +
                                         "   Sex," +
                                         "   Remark ," +
                                         "   PhoneNumber ," +
                                         "   PassWord ," +
                                         "   CreateDateTime," +
                                         "   UpdateDateTime" +
                                         "  )" +
                                         "values( " +
                                         Modfunction.SQLSafeValue(YogaStudioName) + "," +
                                         Modfunction.SQLSafeValue(AreaCode) + "," +
                                         Modfunction.SQLSafeValue(Sex) + "," +
                                         Modfunction.SQLSafeValue(Remark) + "," +
                                         Modfunction.SQLSafeValue(PhoneNumber) + "," +
                                         Modfunction.SQLSafeValue(PassWord) + "," +
                                         "GETDATE()," +
                                         "GETDATE()" +
                                         ") ";
                                db.ExecuteSql(strSql);
                            }
                            Result = 1;
                        }
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
        public int Confirm_Imit1(Imit request)
        {
            int     Result = -1;
            Boolean blnSameCustomer = false;
            string  OldCustomerCode = "", CustomerCode = "", CustomerName = "";

            if (request.NewStoreNoList != null || request.NewStoreNoList != "")
            {
                string[] NewSotreNoDetail = request.NewStoreNoList.Split(',');
                string[] LineItemNoDetail = request.LineItemNoList.Split(',');
                string[] Impm1TrxNoDetail = request.Impm1TrxNoList.Split(',');
                string[] QtyDetail        = request.QtyList.Split(',');
                for (int intI = 0; intI < NewSotreNoDetail.Length; intI++)
                {
                    Result = Insert_Imit2Detail(int.Parse(Impm1TrxNoDetail[intI]), int.Parse(request.TrxNo), int.Parse(LineItemNoDetail[intI]), int.Parse(QtyDetail[intI]), NewSotreNoDetail[intI], request.UpdateBy, ref CustomerCode, ref CustomerName);
                    if (OldCustomerCode == "" && CustomerCode != "")
                    {
                        OldCustomerCode = CustomerCode;
                        blnSameCustomer = true;
                    }
                    else if (OldCustomerCode != CustomerCode)
                    {
                        blnSameCustomer = false;
                    }
                }
                if (blnSameCustomer)
                {
                }
            }
            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
                {
                    //string strSql = "EXEC spi_Imit_Confirm " + int.Parse(request.TrxNo) + ",'" + request.UpdateBy + "'"; 'yicong 20161019
                    string strCustoemrUpdate = "";
                    if (blnSameCustomer)
                    {
                        strCustoemrUpdate = ",CustomerCode = " + Modfunction.SQLSafeValue(CustomerCode);
                    }
                    string strSql = "Update Imit1 set StatusCode='EXE',UpdateBy='" + request.UpdateBy + "'" + strCustoemrUpdate + " where TrxNo='" + request.TrxNo + "' ";
                    Result = db.SqlScalar <int>(strSql);
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #6
0
        public int LoginCheck(WmsLogin request)
        {
            int Result = -1;

            try
            {
                string com = "SELECT count(*) FROM saus1 WHERE UserId =" + Modfunction.SQLSafeValue(request.UserName) + " And Password="******"";
                using (var db = DbConnectionFactory.OpenDbConnection())
                {
                    Result = db.Scalar <int>(com);
                }
            }
            catch
            {
                Result = -1;
            }
            return(Result);
        }
예제 #7
0
파일: Tobk.cs 프로젝트: sysmagicapp/CBGTMS
        public int confirm_Tobk1(Tobk request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection())
                {
                    string str;
                    str = " Note = " + Modfunction.SQLSafeValue(request.Remark) + ",OnBehalfName = " + Modfunction.SQLSafeValue(request.OnBehalfName) + ",StatusCode = 'POD'";
                    db.Update(request.TableName,
                              str,
                              " BookingNo='" + request.Key + "'");
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #8
0
 public string Insert_Aemt1(List <Pid_AEMT1> objAemt1)
 {
     try
     {
         using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
         {
             string KeyMAwbNo = setKeyMAwbNo(Modfunction.CheckNull(objAemt1[0].MAwbNo));
             for (int i = 0; i < objAemt1.Count; i++)
             {
                 string strSql    = "";
                 string TallyById = "";
                 string MAwbNo    = Modfunction.CheckNull(objAemt1[i].MAwbNo);
                 string PID_NO    = Modfunction.CheckNull(objAemt1[i].PID_NO);
                 string LOC_CODE  = Modfunction.CheckNull(objAemt1[i].LOC_CODE);
                 strSql = "insert into Aemt1( " +
                          "  KeyMAwbNo ," +
                          "  MAwbNo," +
                          "  PID_NO, " +
                          "  LOC_CODE, " +
                          "  TallyById," +
                          "  TallyByDateTime" +
                          "  )" +
                          "values( " +
                          Modfunction.SQLSafeValue(KeyMAwbNo) + ", " +
                          Modfunction.SQLSafeValue(MAwbNo) + " , " +
                          Modfunction.SQLSafeValue(PID_NO) + " , " +
                          Modfunction.SQLSafeValue(LOC_CODE) + " , " +
                          Modfunction.SQLSafeValue(TallyById) + "," +
                          " GetDate()" +
                          ") ";
                 db.ExecuteSql(strSql);
             }
             ;
         }
     }
     catch { throw; }
     return("");
 }
예제 #9
0
        public int InsertResult(WhScan request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection())
                {
                    string strSQLCommand = "";
                    if (request.ClearData == "Y")
                    {
                        strSQLCommand = "Delete WhScan Where ComfirmBy = " + Modfunction.SQLSafeValue(request.UserID) + " AND ConfrimType = " + Modfunction.SQLSafeValue(request.ConfrimType);
                        Result        = db.Scalar <int>(strSQLCommand);
                    }
                    strSQLCommand = "insert into whscan(AsnNo,BarCode,ConfirmBy,CustomerCode,GoodsIssueNoteNo,ConfrimType,OldStoreNo,ProductCode,Qty,StoreNo,SerialNo,WarehouseCode,OldWarehouseCode,IssueNoteLineItemNo) Values(" + Modfunction.SQLSafeValue(request.AsnNo) + "," + Modfunction.SQLSafeValue(request.BarCode) + "," + Modfunction.SQLSafeValue(request.UserID) + "," + Modfunction.SQLSafeValue(request.CustomerCode) + "," + Modfunction.SQLSafeValue(request.GoodsIssueNoteNo) + "," + Modfunction.SQLSafeValue(request.ConfrimType) + "," + Modfunction.SQLSafeValue(request.OldStoreNo) + "," + Modfunction.SQLSafeValue(request.ProductCode) + "," + Modfunction.SQLSafeValue(request.Qty) + "," + Modfunction.SQLSafeValue(request.StoreNo) + "," + Modfunction.SQLSafeValue(request.SerialNo) + "," + Modfunction.SQLSafeValue(request.WarehouseCode) + "," + Modfunction.SQLSafeValue(request.OldWarehouseCode) + "," + Modfunction.SQLSafeValue(request.IssueNoteLineItemNo) + ")";
                    Result        = db.Scalar <int>(strSQLCommand);
                }
            }
            catch
            {
                Result = -1;
            }
            return(Result);
        }
예제 #10
0
        public int UpdateAll_tjms2(Tobk request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("TMS"))
                {
                    //if (request.UpdateAllString != null && request.UpdateAllString != "")
                    //{
                    //    JArray ja = (JArray)JsonConvert.DeserializeObject(request.UpdateAllString);
                    //    if (ja != null)
                    //    {
                    //        for (int i = 0; i < ja.Count(); i++)
                    //        {
                    //            int ChargeBerthQty;
                    //            int ChargeLiftingQty;
                    //            if (ja[i]["TrxNo"] == null || ja[i]["TrxNo"].ToString() == "")
                    //            { continue; }
                    //            string strTrxNo = ja[i]["TrxNo"].ToString();
                    //            string strLineItemNo = ja[i]["LineItemNo"].ToString();
                    //            string SignedByName = ja[i]["SignedByName"].ToString();
                    //            string SignedByNric = ja[i]["SignedByNric"].ToString();
                    //            string SignedByDesignation = ja[i]["SignedByDesignation"].ToString();
                    //            string CompanyName = ja[i]["CompanyName"].ToString();
                    //            string strDateCompleted = ja[i]["DateCompleted"].ToString();
                    //            string OfficeInChargeName = ja[i]["OfficeInChargeName"].ToString();
                    //        if (request .ChargeBerthQty.ToString() == "")
                    //        {
                    //request.ChargeBerthQty = 0;
                    //        }
                    //        else
                    //        {
                    //request.ChargeBerthQty = int.Parse(ja[i]["ChargeBerthQty"].ToString());
                    //        }

                    //        if (ja[i]["ChargeLiftingQty"].ToString() == "")
                    //        {
                    //            ChargeLiftingQty = 0;
                    //        }
                    //        else
                    //        {
                    //            ChargeLiftingQty = int.Parse(ja[i]["ChargeLiftingQty"].ToString());
                    //        }

                    //        string ChargeOther = ja[i]["ChargeOther"].ToString();
                    DateTime dt = DateTime.Now;
                    //if (strDateCompleted != "" && strDateCompleted != null) {
                    //    strDateCompleted = strDateCompleted +" "+ dt.GetDateTimeFormats('t')[0].ToString();
                    //}
                    string str;
                    if (request.LineItemNo != "0")
                    {
                        str = "AttachmentFlag='Y' , CustomerSignOffDateTime=GetDate(), completiondate=GetDate(), DateCompleted=GetDate() ,  SignedByName = " + Modfunction.SQLSafeValue(request.SignedByName) + ",SignedByNric= " + Modfunction.SQLSafeValue(request.SignedByNric) + ",SignedByDesignation= " + Modfunction.SQLSafeValue(request.SignedByDesignation) + ",ChargeBerthQty=" + request.ChargeBerthQty + ",ChargeLiftingQty=" + request.ChargeLiftingQty + ",SignalManQty=" + request.SignalManQty + ", ChargeOther=" + Modfunction.SQLSafeValue(request.ChargeOther) + "";
                        db.Update("tjms1",
                                  str,
                                  " TrxNo='" + request.TrxNo + "' ");

                        str = "OfficeInChargeName= " + Modfunction.SQLSafeValue(request.OfficeInChargeName) + "";
                        db.Update("tjms2",
                                  str,
                                  " TrxNo='" + request.TrxNo + "' ");

                        str = " CompanyName = " + Modfunction.SQLSafeValue(request.CompanyName) + "";
                        db.Update("saco1",
                                  str
                                  );
                    }

                    Result = 1;
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #11
0
        public string GetUserInfo(Event_Login request)
        {
            string Result = "";

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("TMS"))
                {
                    Result = db.QuerySingle <string>("Select Top 1 ISNULL(DriverName,'') From Jmjm4 Where PhoneNumber=" + Modfunction.SQLSafeValue(request.PhoneNumber));
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #12
0
        public int ConfirmAll_ONHAND_D(ONHAND_D request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection())
                {
                    if (request.UpdateAllString != null && request.UpdateAllString != "")
                    {
                        JArray ja = (JArray)JsonConvert.DeserializeObject(request.UpdateAllString);
                        if (ja != null)
                        {
                            for (int i = 0; i < ja.Count(); i++)
                            {
                                string strSql              = "";
                                string SHP_CODE            = ja[i]["SHP_CODE"].ToString();
                                string CNG_CODE            = ja[i]["CNG_CODE"].ToString();
                                string ONHAND_date         = ja[i]["ONHAND_date"].ToString();
                                string CASE_NO             = CASE_NO = ja[i]["CASE_NO"].ToString();
                                string PUB_YN              = ja[i]["PUB_YN"].ToString();
                                string HAZARDOUS_YN        = ja[i]["HAZARDOUS_YN"].ToString();
                                string CLSF_YN             = ja[i]["CLSF_YN"].ToString();
                                string ExerciseFlag        = ja[i]["ExerciseFlag"].ToString();
                                string LOC_CODE            = ja[i]["LOC_CODE"].ToString();
                                string TRK_CODE            = ja[i]["TRK_CODE"].ToString();
                                string TRK_CHRG_TYPE       = ja[i]["TRK_CHRG_TYPE"].ToString();
                                string PICKUP_SUP_datetime = ja[i]["PICKUP_SUP_datetime"].ToString();
                                int    NO_INV_WH;
                                string UserID = ja[i]["UserID"].ToString();
                                if (ja[i]["NO_INV_WH"].ToString() == "")
                                {
                                    NO_INV_WH = 0;
                                }
                                else
                                {
                                    NO_INV_WH = int.Parse(ja[i]["NO_INV_WH"].ToString());
                                }

                                strSql = "insert into ONHAND_D( " +
                                         "   onhand_no," +
                                         "   SHP_CODE," +
                                         "   CNG_CODE ," +
                                         "   ONHAND_date," +
                                         "   CASE_NO ," +
                                         "   PUB_YN," +
                                         "   HAZARDOUS_YN ," +
                                         "   CLSF_YN ," +
                                         "   ExerciseFlag ," +
                                         "   LOC_CODE ," +
                                         "   TRK_CODE ," +
                                         "   TRK_CHRG_TYPE ," +
                                         "   PICKUP_SUP_datetime," +
                                         "   NO_INV_WH," +
                                         "   CreateBy," +
                                         "   UpdateBy," +
                                         "   CreateDateTime," +
                                         "   UpdateDateTime," +
                                         "   StatusCode " +
                                         "  )" +
                                         "values( " +
                                         Modfunction.SQLSafeValue(generateOnhandNo()) + " , " +
                                         Modfunction.SQLSafeValue(SHP_CODE) + "," +
                                         Modfunction.SQLSafeValue(CNG_CODE) + "," +
                                         Modfunction.SQLSafeValue(ONHAND_date) + "," +
                                         Modfunction.SQLSafeValue(CASE_NO) + "," +
                                         Modfunction.SQLSafeValue(PUB_YN) + "," +
                                         Modfunction.SQLSafeValue(HAZARDOUS_YN) + "," +
                                         Modfunction.SQLSafeValue(CLSF_YN) + "," +
                                         Modfunction.SQLSafeValue(ExerciseFlag) + "," +
                                         Modfunction.SQLSafeValue(LOC_CODE) + "," +
                                         Modfunction.SQLSafeValue(TRK_CODE) + "," +
                                         Modfunction.SQLSafeValue(TRK_CHRG_TYPE) + "," +
                                         Modfunction.SQLSafeValue(PICKUP_SUP_datetime) + "," +
                                         NO_INV_WH + "," +
                                         Modfunction.SQLSafeValue(UserID) + "," +
                                         Modfunction.SQLSafeValue(UserID) + "," +
                                         "GETDATE()," +
                                         "GETDATE()," +
                                         "'USE'" +
                                         ") ";
                                db.ExecuteSql(strSql);
                            }
                        }
                        Result = 1;
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #13
0
        public Impr1 GetList(List_Impr1 request)
        {
            Impr1 Result = null;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
                {
                    Result = db.QuerySingle <Impr1>(
                        "Select * From Impr1 Where IsNull(ProductCode,'')<>'' And IsNull(StatusCode,'')<>'DEL' And UserDefine01=" + Modfunction.SQLSafeValue(request.BarCode)
                        );
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #14
0
        private string SaveImgr(DataTable dtWhScan, DataTable dtOmtx)
        {
            DataTable dtRec         = null;
            string    Result        = "";
            int       intSaveResult = -1;
            DataTable dtImgr1       = GetSQLCommandReturnDT("Select Top 0 * from Imgr1");

            dtImgr1.Columns.Remove(dtImgr1.Columns["TrxNo"]);
            dtImgr1.Columns.Remove(dtImgr1.Columns["CreateDateTime"]);
            dtImgr1.Columns.Remove(dtImgr1.Columns["UpdateDateTime"]);
            dtImgr1.Rows.Add(dtImgr1.NewRow());
            dtImgr1.Rows[0]["CustomerCode"]       = dtWhScan.Rows[0]["CustomerCode"];
            dtImgr1.Rows[0]["WarehouseCode"]      = dtWhScan.Rows[0]["WarehouseCode"];
            dtImgr1.Rows[0]["WarehouseName"]      = dtWhScan.Rows[0]["WarehouseName"];
            dtImgr1.Rows[0]["CustomerName"]       = dtWhScan.Rows[0]["BusinessPartyName"];
            dtImgr1.Rows[0]["CustomerAddress1"]   = dtWhScan.Rows[0]["Address1"];
            dtImgr1.Rows[0]["CustomerAddress2"]   = dtWhScan.Rows[0]["Address2"];
            dtImgr1.Rows[0]["CustomerAddress3"]   = dtWhScan.Rows[0]["Address3"];
            dtImgr1.Rows[0]["CustomerAddress4"]   = dtWhScan.Rows[0]["Address4"];
            dtImgr1.Rows[0]["ReceiptDate"]        = DateTime.Today;
            dtImgr1.Rows[0]["CreateBy"]           = dtWhScan.Rows[0]["ConfirmBy"];
            dtImgr1.Rows[0]["UpdateBy"]           = dtWhScan.Rows[0]["ConfirmBy"];
            dtImgr1.Rows[0]["WorkStation"]        = "PDADriver_" + dtWhScan.Rows[0]["ConfirmBy"].ToString();
            dtImgr1.Rows[0]["GoodsReceiptNoteNo"] = CreateGoodsReceiptNo(dtImgr1, "Imgr");
            if (dtImgr1.Rows[0]["GoodsReceiptNoteNo"] == null || dtImgr1.Rows[0]["GoodsReceiptNoteNo"].ToString() == "")
            {
                dtRec = GetSQLCommandReturnDT("Select NextGoodsReceiptNo From Impa1");
                dtImgr1.Rows[0]["GoodsReceiptNoteNo"] = Modfunction.CheckNull(dtRec.Rows[0][0]);
                string strNewNextGoodsReceiptNo = CheckUpdateFieldLength(Modfunction.CheckNull(dtRec.Rows[0][0])).ToString();
                GetSQLCommandReturnInt("Update Impa1 set NextGoodsReceiptNo = '" + Modfunction.SQLSafe(strNewNextGoodsReceiptNo) + "'");
            }
            intSaveResult = InsertTableRecordByDatatable("Imgr1", dtImgr1);
            if (intSaveResult == -1)
            {
                return("Confirm unsuccess.");
            }
            dtRec = GetSQLCommandReturnDT("Select Max(TrxNo) from Imgr1 Where WorkStation = " + Modfunction.SQLSafeValue(dtImgr1.Rows[0]["WorkStation"]) + " AND CreateBy = " + Modfunction.SQLSafeValue(dtImgr1.Rows[0]["CreateBy"]) + " AND CustomerCode = " + Modfunction.SQLSafeValue(dtImgr1.Rows[0]["CustomerCode"]));
            if (dtRec != null && dtRec.Rows.Count > 0)
            {
                int       intTrxNo = Convert.ToInt32(dtRec.Rows[0][0]);
                DataTable dtImgr2  = GetSQLCommandReturnDT("Select Top 0 from Imgr2 ");
                dtImgr2.Rows.Clear();
                for (int intIndex = 0; intIndex < dtWhScan.Rows.Count; intIndex++)
                {
                    dtRec = GetSQLCommandReturnDT("Select * from Impr1 Where TrxNo = " + Convert.ToInt32(dtWhScan.Rows[intIndex]["ProductTrxNo"]).ToString());
                    if (dtRec != null && dtRec.Rows.Count > 0)
                    {
                        dtImgr2.Rows.Add(dtImgr2.NewRow());
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["TrxNo"]              = intTrxNo;
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["LineItemNo"]         = dtImgr2.Rows.Count;
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["DimensionFlag"]      = dtRec.Rows[0]["DimensionFlag"];
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["UnitVol"]            = dtRec.Rows[0]["UnitVol"];
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["UnitWt"]             = dtRec.Rows[0]["UnitWt"];
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["UnitVolFlag"]        = dtRec.Rows[0]["UnitVolFlag"];
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["ProductTrxNo"]       = dtRec.Rows[0]["TrxNo"];
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["ProductDescription"] = dtRec.Rows[0]["ProductName"];
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["Weight"]             = Convert.ToDecimal(dtRec.Rows[0]["UnitWt"]) * Convert.ToInt32(dtWhScan.Rows[intIndex]["Qty"]);
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["Volume"]             = Convert.ToDecimal(dtRec.Rows[0]["UnitVol"]) * Convert.ToInt32(dtWhScan.Rows[intIndex]["Qty"]);
                        if (dtRec.Rows[0]["DimensionFlag"] != null)
                        {
                            if (dtRec.Rows[0]["DimensionFlag"].ToString() == "1")
                            {
                                dtImgr2.Rows[dtImgr2.Rows.Count - 1]["PackingQty"] = dtWhScan.Rows[intIndex]["Qty"];
                                dtImgr2.Rows[dtImgr2.Rows.Count - 1]["WholeQty"]   = Convert.ToInt32(dtWhScan.Rows[intIndex]["Qty"]) * Convert.ToInt32(dtRec.Rows[0]["PackingPackageSize"]);
                                dtImgr2.Rows[dtImgr2.Rows.Count - 1]["LooseQty"]   = Convert.ToInt32(dtImgr2.Rows[dtImgr2.Rows.Count - 1]["WholeQty"]) * Convert.ToInt32(dtRec.Rows[0]["WholePackageSize"]);
                            }
                            if (dtRec.Rows[0]["DimensionFlag"].ToString() == "2")
                            {
                                dtImgr2.Rows[dtImgr2.Rows.Count - 1]["WholeQty"] = dtWhScan.Rows[intIndex]["Qty"];
                                dtImgr2.Rows[dtImgr2.Rows.Count - 1]["LooseQty"] = Convert.ToInt32(dtImgr2.Rows[dtImgr2.Rows.Count - 1]["WholeQty"]) * Convert.ToInt32(dtRec.Rows[0]["WholePackageSize"]);
                            }
                            if (dtRec.Rows[0]["DimensionFlag"].ToString() == "3")
                            {
                                dtImgr2.Rows[dtImgr2.Rows.Count - 1]["LooseQty"] = dtWhScan.Rows[intIndex]["Qty"];
                            }
                        }
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["DimensionFlag"] = dtRec.Rows[0]["DimensionFlag"];
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["StoreNo"]       = dtWhScan.Rows[intIndex]["StoreNo"];
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["CustomerCode"]  = dtWhScan.Rows[intIndex]["CustomerCode"];
                        dtImgr2.Rows[dtImgr2.Rows.Count - 1]["WarehouseCode"] = dtWhScan.Rows[intIndex]["WarehouseCode"];
                        saveImsn1SerialNo(Modfunction.CheckNull(dtImgr1.Rows[0]["GoodsReceiptNoteNo"]), Convert.ToInt32(dtImgr2.Rows[dtImgr2.Rows.Count - 1]["LineItemNo"]), Modfunction.CheckNull(dtWhScan.Rows[intIndex]["SerialNo"]), true);
                    }
                }
                if (dtImgr2 != null && dtImgr2.Rows.Count > 0)
                {
                    intSaveResult = InsertTableRecordByDatatable("Imgr2", dtImgr2);
                    if (intSaveResult == -1)
                    {
                        return("Confirm unsuccess.");
                    }
                }
            }
            else
            {
                Result = "Confirm Unsuccess.";
            }
            return(Result);
        }
예제 #15
0
파일: Imgi.cs 프로젝트: sysmagicapp/OnHand
        public int Comfirm_Picking_Imgi3(Imgi request)
        {
            int Result = -1;

            try
            {
                if (request.TrxNo != null && request.TrxNo.Trim() != "")
                {
                    string[] LineItemNoList = request.LineItemNoList.Split(',');

                    string [] ProductCodeList        = request.ProductCodeList.Split(',');
                    string[]  QtyList                = request.QtyList.Split(',');
                    string[]  PackingNoList          = request.PackingNoList.Split(',');
                    string[]  ProductDescriptionList = request.ProductDescriptionList.Split(',');
                    string[]  ProductTrxNoList       = request.ProductTrxNoList.Split(',');



                    using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
                    {
                        string strPackingListDone = "";
                        string strCurrentPackingNo = "";
                        int    PackingQty = 0, WholeQty = 0, LooseQty = 0;
                        for (int i = 1; i < LineItemNoList.Length; i++)
                        {
                            if (strPackingListDone != "" && strPackingListDone.IndexOf(PackingNoList[i] + ',' + ProductCodeList[i]) > 0)
                            {
                                continue;
                            }
                            strCurrentPackingNo = PackingNoList[i] + ',' + ProductCodeList[i];
                            int intQty = int.Parse(QtyList[i]);
                            for (int j = i + 1; j < LineItemNoList.Length; j++)
                            {
                                if (strCurrentPackingNo == PackingNoList[j] + ',' + ProductCodeList[j])
                                {
                                    intQty = intQty + int.Parse(QtyList[j]);
                                }
                            }

                            if (request.DimensionFlag != null && request.DimensionFlag != "")
                            {
                                switch (request.DimensionFlag)
                                {
                                case "1":
                                    PackingQty = intQty;
                                    break;

                                case "2":
                                    WholeQty = intQty;
                                    break;

                                case "3":
                                    LooseQty = intQty;
                                    break;
                                }
                            }
                            int intMaxLineItemNo = 1;

                            List <Imgi3> list1 = db.Select <Imgi3>("Select Max(LineItemNo) LineItemNo from Imgi3 Where TrxNo = " + Modfunction.SQLSafeValue(request.TrxNo));
                            if (list1 != null)
                            {
                                if (list1[0].LineItemNo > 0)
                                {
                                    intMaxLineItemNo = list1[0].LineItemNo + 1;
                                }
                            }
                            db.ExecuteSql("insert into imgi3 (TrxNo, LineItemNo, PackingNo,ProductTrxNo, ProductDescription,PackingQty, WholeQty, LooseQty,Volume) values (" +
                                          Modfunction.SQLSafe(request.TrxNo) + "," + intMaxLineItemNo + "," + Modfunction.SQLSafeValue(PackingNoList[i].ToString()) + "," + int.Parse(ProductTrxNoList[i].ToString()) + " ," + Modfunction.SQLSafeValue(ProductDescriptionList[i].ToString()) + "," + PackingQty + "," + WholeQty + "," + LooseQty + " ,0 )");



                            strPackingListDone = strPackingListDone + ',' + strCurrentPackingNo;
                        }
                        //    string UpdateNewFlag = "N";
                        //    if (request.NewFlagList == null || request.NewFlagList.Trim() == "")
                        //    {
                        //        Result = db.SqlScalar<int>("EXEC spi_Imgr2_Mobile @TrxNo,@LineItemNo,@NewFlag,@DimensionQty,@QtyRemark,@DimensionFlag,@StoreNo,@UpdateBy", new { TrxNo = int.Parse(request.TrxNo), LineItemNo = int.Parse(request.LineItemNoList), NewFlag = UpdateNewFlag, DimensionQty = int.Parse(request.DimensionQtyList), QtyRemark = request.QtyRemarkList, DimensionFlag = request.DimensionFlagList, StoreNo = request.StoreNoList, UpdateBy = request.UserID });
                        //    }
                        //    else
                        //    {
                        //        for (int i = 0; i < DimensionFlagDetail.Length; i++)
                        //        {
                        //            UpdateNewFlag = NewFlagDetail[i];
                        //            if (UpdateNewFlag != "Y")
                        //            { UpdateNewFlag = "N"; }
                        //            Result = db.SqlScalar<int>("EXEC spi_Imgr2_Mobile @TrxNo,@LineItemNo,@NewFlag,@DimensionQty,@QtyRemark,@DimensionFlag,@StoreNo,@UpdateBy", new { TrxNo = int.Parse(request.TrxNo), LineItemNo = int.Parse(LineItemNoDetail[i]), NewFlag = UpdateNewFlag, DimensionQty = DimensionQtyDetail[i], QtyRemark = QtyRemarkDetail[i], DimensionFlag = DimensionFlagDetail[i], StoreNo = StoreNoDetail[i], UpdateBy = request.UserID });
                        //        }
                        //    }
                        //    Result = db.SqlScalar<int>("EXEC spi_Imgr_Confirm @TrxNo,@UpdateBy", new { TrxNo = int.Parse(request.TrxNo), UpdateBy = request.UserID });
                        //    if (Result != -1)
                        //    {
                        //        List<Imgr2_Receipt> Result1 = null;
                        //        Result1 = db.Select<Imgr2_Receipt>(
                        //                                "select Imgr1.GoodsReceiptNoteNo,Imgr1.CustomerCode,Imgr2.LineItemNo,Imgr1.TrxNo from imgr1 join imgr2 on imgr1.TrxNo =imgr2.TrxNo where Imgr1.TrxNo =  '" + request.TrxNo + "' "
                        //                );
                        //        if (Result1 != null && Result1.Count > 0)
                        //        {
                        //            for (int i = 0; i < Result1.Count; i++)
                        //            {
                        //                Result = db.SqlScalar<int>("Update Imgr2 Set MovementTrxNo=(Select top 1 TrxNo From Impm1 Where BatchNo=@GoodsReceiptNoteNo And BatchLineItemNo=@BatchLineItemNo And CustomerCode=@CustomerCode) Where TrxNo=@TrxNo  And LineItemNo=@LineItemNo", new { GoodsReceiptNoteNo = Result1[i].GoodsReceiptNoteNo, BatchLineItemNo = Result1[i].LineItemNo, CustomerCode = Result1[i].CustomerCode, TrxNo = int.Parse(request.TrxNo), LineItemNo = Result1[i].LineItemNo });
                        //            }
                        //        }
                        //    }
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #16
0
        public int UpdateAll_tjms5(Tobk request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("TMS"))
                {
                    //if (request.UpdateAllString != null && request.UpdateAllString != "")
                    //{
                    //    JArray ja = (JArray)JsonConvert.DeserializeObject(request.UpdateAllString);
                    //    if (ja != null)
                    //    {
                    //        for (int i = 0; i < ja.Count(); i++)
                    //        {

                    if (request.TrxNo.Length > 0)
                    {
                        int    TrxNo                    = Modfunction.ReturnZero(request.TrxNo.ToString());
                        string EquipmentType            = Modfunction.SQLSafeValue(Modfunction.CheckNull(request.EquipmentType));
                        string EquipmentTypeDescription = Modfunction.SQLSafeValue(Modfunction.CheckNull(request.EquipmentTypeDescription));
                        string ContainerNo              = Modfunction.SQLSafeValue(Modfunction.CheckNull(request.ContainerNo));
                        string CargoDescription         = Modfunction.SQLSafeValue(Modfunction.CheckNull(request.CargoDescription));
                        double Volume                   = Modfunction.ReturnDobule(request.Volume);
                        double ChargeWeight             = Modfunction.ReturnDobule(request.ChargeWeight);
                        double ChgWtRoundUp             = Modfunction.ReturnDobule(request.ChgWtRoundUp);
                        string VehicleNo                = Modfunction.SQLSafeValue(Modfunction.CheckNull(request.VehicleNo));
                        int    LineItemNo               = Modfunction.ReturnZero(request.LineItemNo.ToString());

                        //int TrxNo = Modfunction.ReturnZero(request.TrxNo.ToString());
                        //string EquipmentType = Modfunction.SQLSafeValue(request.EquipmentType);
                        //string EquipmentTypeDescription = Modfunction.SQLSafeValue(request.EquipmentTypeDescription);
                        //string ContainerNo = Modfunction.SQLSafeValue(request.ContainerNo);
                        //string CargoDescription = Modfunction.SQLSafeValue(request.CargoDescription);
                        //int Volume = Modfunction.ReturnZero(request.Volume.ToString());
                        //int ChargeWeight = Modfunction.ReturnZero(request.ChargeWeight.ToString());
                        //int ChgWtRoundUp = Modfunction.ReturnZero(Modfunction.CheckNull(request.ChgWtRoundUp));
                        //string VehicleNo = Modfunction.SQLSafeValue(request.VehicleNo);
                        //int LineItemNo = Modfunction.ReturnZero(request.LineItemNo.ToString());


                        string strSql = "";
                        if (LineItemNo != 0)
                        {
                            strSql = "Update tjms5 set " +
                                     "EquipmentType=" + EquipmentType + " , " +
                                     "EquipmentTypeDescription=" + EquipmentTypeDescription + " ," +
                                     "ContainerNo=" + ContainerNo + " , " +
                                     "CargoDescription=" + CargoDescription + " , " +
                                     "Volume=" + Volume + " ," +
                                     "ChargeWeight=" + ChargeWeight + " , " +
                                     "ChgWtRoundUp=" + ChgWtRoundUp + ",  " +
                                     "EditFlag=(select EditFlag from tovt1 where VehicleTypeDescription=" + EquipmentTypeDescription + " )," +
                                     " VehicleNo=" + VehicleNo + " " +
                                     "Where LineItemNo =" + LineItemNo + " And TrxNo=" + TrxNo + "";
                            db.ExecuteSql(strSql);

                            strSql = "  update tjms2 set ChargeWeight = (select sum(ChgWtRoundUp) from tjms5 where TrxNo=" + TrxNo + ")  Where LineItemNo =1 and TrxNo=" + TrxNo + " ";
                            db.ExecuteSql(strSql);
                        }
                    }
                    //    }
                    //}
                    Result = 1;

                    //}
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #17
0
        public string Putway(string strAsn, string strConfirmBy)
        {
            string    Result = "";
            DataTable dtOmtx2, dtWhScan;
            string    strBarCodeColumn = GetBarCode("UserDefine01");

            dtWhScan = GetSQLCommandReturnDT("Select WhScan.*,(Select TrxNo from Impr1 Where impr1. " + strBarCodeColumn + " = Whscan.BarCode) AS ProductCodeTrxNo,(Select WarehouseName from whwh1 where WarehouseCode = WhScan.WareHouse ) AS WarehouseName,rcbp1.BusinessPartyName,rcbp1.Address1,rcbp1.Address2,rcbp1.Address3,rcbp1.Address4  from WhScan Join Rcbp1 on WhScan.CustomerCode=Rcbp1.BusinessPartyCode Where AsnNo = " + Modfunction.SQLSafeValue(strAsn) + " AND ComfirmBy = " + Modfunction.SQLSafeValue(strConfirmBy));
            if (dtWhScan != null && dtWhScan.Rows.Count > 0)
            {
                dtOmtx2 = GetSQLCommandReturnDT("select BalanceLooseQty,BalancePackingQty,BalanceWholeQty,DimensionFlag,ProductCode,TrxNo,LineItemNo from Omtx2 Where TrxNo = (Select Top 1 TrxNo from Omtx1 Where AsnNo = " + Modfunction.SQLSafeValue(strAsn) + ")");
                if (dtOmtx2 != null && dtOmtx2.Rows.Count > 0)
                {
                    SaveImgr(dtWhScan, dtOmtx2);
                }
            }
            return(Result);
        }
예제 #18
0
        public List <Todr1> GetTodr1(Tms_Login request)       //20160511
        {
            List <Todr1> Result = null;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("TMS"))
                {
                    var strSQL = "";
                    if (BlnContactNo == false)
                    {
                        strSQL = "select isnull(DriverCode,'') as  DriverCode,isnull(DriverName,'') as  DriverName from todr1 where ContactNo2=" + Modfunction.SQLSafeValue(request.ContactNo);
                        Result = db.Select <Todr1>(strSQL);
                    }
                    else
                    {
                        strSQL = "select isnull(DriverCode,'') as  DriverCode,isnull(DriverName,'') as  DriverName from todr1 where ContactNo1=" + Modfunction.SQLSafeValue(request.ContactNo);
                        Result = db.Select <Todr1>(strSQL);
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #19
0
        public int ConfirmAll_Imcc2(imcc request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection())
                {
                    if (request.UpdateAllString != null && request.UpdateAllString != "")
                    {
                        JArray ja = (JArray)JsonConvert.DeserializeObject(request.UpdateAllString);
                        if (ja != null)
                        {
                            for (int i = 0; i < ja.Count(); i++)
                            {
                                int TrxNo;
                                int LineItemNo;
                                int ProductTrxNo = 0;
                                int PackingQty;
                                int WholeQty;
                                int LooseQty;

                                if (ja[i]["TrxNo"] != null || ja[i]["TrxNo"].ToString() != "")
                                {
                                    if (ja[i]["LineItemNo"] != null || ja[i]["LineItemNo"].ToString() != "")
                                    {
                                        TrxNo      = int.Parse(ja[i]["TrxNo"].ToString());
                                        LineItemNo = int.Parse(ja[i]["LineItemNo"].ToString());
                                        if (ja[i]["ProductTrxNo"] != null || ja[i]["ProductTrxNo"].ToString() != "")
                                        {
                                            ProductTrxNo = int.Parse(ja[i]["ProductTrxNo"].ToString());
                                        }

                                        if (ja[i]["PackingQtyTempValue"].ToString() == "")
                                        {
                                            PackingQty = 0;
                                        }
                                        else
                                        {
                                            PackingQty = int.Parse(ja[i]["PackingQtyTempValue"].ToString());
                                        }
                                        if (ja[i]["WholeQtyTempValue"].ToString() == "")
                                        {
                                            WholeQty = 0;
                                        }
                                        else
                                        {
                                            WholeQty = int.Parse(ja[i]["WholeQtyTempValue"].ToString());
                                        }
                                        if (ja[i]["LooseQtyTempValue"].ToString() == "")
                                        {
                                            LooseQty = 0;
                                        }
                                        else
                                        {
                                            LooseQty = int.Parse(ja[i]["LooseQtyTempValue"].ToString());
                                        }

                                        db.ExecuteSql("insert into impm1 (CustomerCode, WarehouseCode, StoreNo,ProductCode ,Description, DimensionFlag, PackingQty, WholeQty,LooseQty,ProductTrxNo,UpdateBy) values (" +
                                                      Modfunction.SQLSafeValue(ja[i]["CustomerCode"].ToString()) + "," + Modfunction.SQLSafeValue(ja[i]["WarehouseCode"].ToString()) + "," + Modfunction.SQLSafeValue(ja[i]["StoreNo"].ToString()) + "," + Modfunction.SQLSafeValue(ja[i]["ProductCode"].ToString()) + "," + Modfunction.SQLSafeValue(ja[i]["Description"].ToString()) + "," +
                                                      Modfunction.SQLSafeValue(ja[i]["DimensionFlag"].ToString()) + "," + PackingQty + "," + WholeQty + "," + LooseQty + "," + ProductTrxNo + "," + Modfunction.SQLSafeValue(ja[i]["UserId"].ToString()) + ")");

                                        string str;
                                        string strTableName = "imcc2";
                                        str = " PackingQty = " + PackingQty + ",WholeQty = " + WholeQty + ",LooseQty = " + LooseQty + ", UpdateBy=" + Modfunction.SQLSafeValue(ja[i]["UserId"].ToString()) + "";
                                        db.Update(strTableName,
                                                  str,
                                                  " TrxNo=" + TrxNo + " and LineItemNo=" + LineItemNo + "");
                                    }
                                }
                            }
                            Result = 1;
                        }
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #20
0
        private int InsertTableRecordByDatatable(string strtableName, DataTable dt)
        {
            int result = -1;

            for (int intI = 0; intI <= dt.Rows.Count - 1; intI++)
            {
                string strFieldList = "";
                string strValueList = "";
                for (int intCol = 0; intCol <= dt.Columns.Count - 1; intCol++)
                {
                    strFieldList = strFieldList + (string.IsNullOrEmpty(strFieldList.Trim()) ? "" : ",") + dt.Columns[intCol].ColumnName;
                    if (GetDataType(dt.Columns[intCol].DataType.Name) == 2 && dt.Rows[intI][intCol] != null)
                    {
                        if (Convert.ToInt32(((DateTime)dt.Rows[intI][intCol]).ToString("HHmm")) > 0)
                        {
                            strValueList = strValueList + (string.IsNullOrEmpty(strValueList.Trim()) ? "" : ",") + "'" + ((DateTime)dt.Rows[intI][intCol]).ToString("yyyy-MM-dd HH:mm") + "'";
                        }
                        else
                        {
                            strValueList = strValueList + (string.IsNullOrEmpty(strValueList.Trim()) ? "" : ",") + "'" + ((DateTime)dt.Rows[intI][intCol]).ToString("yyyy-MM-dd") + "'";
                        }
                    }
                    else
                    {
                        strValueList = strValueList + (string.IsNullOrEmpty(strValueList.Trim()) ? "" : ",") + Modfunction.SQLSafeValue(dt.Rows[intI][intCol]);
                    }
                }
                result = GetSQLCommandReturnInt("Insert into  " + strtableName + " (" + strFieldList + ") Values(" + strValueList + ")");
            }
            return(result);
        }
예제 #21
0
 private void saveImsn1SerialNo(string strNoteNo, int intLineItemNo, string strSerialNo, Boolean blnRecript)
 {
     if (strSerialNo == "")
     {
         return;
     }
     string[] strSerialList = System.Text.RegularExpressions.Regex.Split(strSerialNo, ",");
     if (strSerialList != null)
     {
         for (int i = 0; i < strSerialList.Length; i++)
         {
             if (blnRecript == true)
             {
                 GetSQLCommandReturnInt("Insert into imsn1(ReceiptNoteNo,ReceiptLineItemNo,SerialNo) Values(" + Modfunction.SQLSafeValue(strNoteNo) + "," + intLineItemNo.ToString() + "," + Modfunction.SQLSafeValue(strSerialList[i]) + ")");
             }
             else
             {
                 GetSQLCommandReturnInt("Insert into imsn1(IssueNoteNo,IssueLineItemNo,SerialNo) Values(" + Modfunction.SQLSafeValue(strNoteNo) + "," + intLineItemNo.ToString() + "," + Modfunction.SQLSafeValue(strSerialList[i]) + ")");
             }
         }
     }
 }
예제 #22
0
        public string GoodsTransfer(string strAsn, string strConfirmBy)
        {
            string    Result          = "";
            string    strBarCode      = GetBarCode("UserDefine01");
            DataTable dtWhScan        = GetSQLCommandReturnDT("Select *,Impr1.TrxNo AS PrductTrxNo,Impr1.CustomerCode AS ProductCustomerCode from WhScan join Impr1 On Impr1." + strBarCode + " = WhScan.BarCode Where AsnNo = " + Modfunction.SQLSafeValue(strAsn) + " AND ComfirmBy = " + Modfunction.SQLSafeValue(strConfirmBy));
            Boolean   blnSameCustomer = true;

            if (dtWhScan != null && dtWhScan.Rows.Count > 0)
            {
                string strCustomer = Modfunction.CheckNull(dtWhScan.Rows[0]["ProductCustomerCode"]);
                for (int i = 1; i < dtWhScan.Rows.Count; i++)
                {
                    if (strCustomer != Modfunction.CheckNull(dtWhScan.Rows[0]["ProductCustomerCode"]))
                    {
                        blnSameCustomer = false;
                        break;
                    }
                }
                Result = SaveImit(dtWhScan, blnSameCustomer);
            }
            return(Result);
        }
        public List <Imgi1> Get_Imgi1_List(Imgi request)
        {
            List <Imgi1> Result = null;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
                {
                    if (!string.IsNullOrEmpty(request.CustomerCode))
                    {
                        if (!string.IsNullOrEmpty(request.StatusCode))
                        {
                            Result = db.Select <Imgi1>("Select * from imgi1 where StatusCode = 'EXE' AND Convert(Char(10), IssueDateTime, 20) = Convert(Char(10), getdate(), 20) AND CustomerCode = " + Modfunction.SQLSafeValue(request.CustomerCode));
                            //Result = db.SelectParam<Imgi1>(
                            //            i => i.CustomerCode != null && i.CustomerCode != "" && i.StatusCode != null && i.StatusCode != "DEL" && i.StatusCode != "EXE" && i.CustomerCode == request.CustomerCode
                            //).OrderByDescending(i => i.IssueDateTime).ToList<Imgi1>();
                        }
                        else
                        {
                            Result = db.SelectParam <Imgi1>(
                                i => i.CustomerCode != null && i.CustomerCode != "" && i.StatusCode != null && i.StatusCode != "DEL" && i.StatusCode != "EXE" && i.StatusCode != "CMP" && i.CustomerCode == request.CustomerCode
                                ).OrderByDescending(i => i.IssueDateTime).ToList <Imgi1>();
                        }
                    }
                    else if (!string.IsNullOrEmpty(request.GoodsIssueNoteNo))
                    {
                        if (!string.IsNullOrEmpty(request.StatusCode))
                        {
                            Result = db.Select <Imgi1>("Select * from imgi1 where StatusCode = 'EXE' AND Convert(Char(10), IssueDateTime, 20) = Convert(Char(10), getdate(), 20) AND GoodsIssueNoteNo like '" + Modfunction.SQLSafe(request.GoodsIssueNoteNo) + "%'");
                            //Result = db.SelectParam<Imgi1>(
                            //                i => i.CustomerCode != null && i.CustomerCode != "" && i.StatusCode != null && i.StatusCode != "DEL" && i.StatusCode != "EXE" && i.GoodsIssueNoteNo.StartsWith(request.GoodsIssueNoteNo)
                            //).OrderByDescending(i => i.IssueDateTime).ToList<Imgi1>();
                        }
                        else
                        {
                            Result = db.SelectParam <Imgi1>(
                                i => i.CustomerCode != null && i.CustomerCode != "" && i.StatusCode != null && i.StatusCode != "DEL" && i.StatusCode != "EXE" && i.StatusCode != "CMP" && i.GoodsIssueNoteNo.StartsWith(request.GoodsIssueNoteNo)
                                ).OrderByDescending(i => i.IssueDateTime).ToList <Imgi1>();
                        }
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #24
0
        public int UpdateAll_tjms2(Tobk request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection())
                {
                    if (request.UpdateAllString != null && request.UpdateAllString != "")
                    {
                        JArray ja = (JArray)JsonConvert.DeserializeObject(request.UpdateAllString);
                        if (ja != null)
                        {
                            for (int i = 0; i < ja.Count(); i++)
                            {
                                int ChargeBerthQty;
                                int ChargeLiftingQty;
                                if (ja[i]["TrxNo"] == null || ja[i]["TrxNo"].ToString() == "")
                                {
                                    continue;
                                }
                                string strTrxNo            = ja[i]["TrxNo"].ToString();
                                string strLineItemNo       = ja[i]["LineItemNo"].ToString();
                                string SignedByName        = ja[i]["SignedByName"].ToString();
                                string SignedByNric        = ja[i]["SignedByNric"].ToString();
                                string SignedByDesignation = ja[i]["SignedByDesignation"].ToString();
                                string CompanyName         = ja[i]["CompanyName"].ToString();
                                string strDateCompleted    = ja[i]["DateCompleted"].ToString();
                                string OfficeInChargeName  = ja[i]["OfficeInChargeName"].ToString();
                                if (ja[i]["ChargeBerthQty"].ToString() == "")
                                {
                                    ChargeBerthQty = 0;
                                }
                                else
                                {
                                    ChargeBerthQty = int.Parse(ja[i]["ChargeBerthQty"].ToString());
                                }

                                if (ja[i]["ChargeLiftingQty"].ToString() == "")
                                {
                                    ChargeLiftingQty = 0;
                                }
                                else
                                {
                                    ChargeLiftingQty = int.Parse(ja[i]["ChargeLiftingQty"].ToString());
                                }

                                string   ChargeOther = ja[i]["ChargeOther"].ToString();
                                DateTime dt          = DateTime.Now;
                                if (strDateCompleted != "" && strDateCompleted != null)
                                {
                                    strDateCompleted = strDateCompleted + " " + dt.GetDateTimeFormats('t')[0].ToString();
                                }
                                string str;
                                if (strLineItemNo != "0")
                                {
                                    str = " SignedByName = " + Modfunction.SQLSafeValue(SignedByName) + ",SignedByNric= " + Modfunction.SQLSafeValue(SignedByNric) + ",SignedByDesignation= " + Modfunction.SQLSafeValue(SignedByDesignation) + ",DateCompleted=" + Modfunction.SQLSafeValue(strDateCompleted) + ",ChargeBerthQty=" + ChargeBerthQty + ",ChargeLiftingQty=" + ChargeLiftingQty + ",ChargeOther=" + Modfunction.SQLSafeValue(ChargeOther) + "";
                                    db.Update("tjms1",
                                              str,
                                              " TrxNo='" + strTrxNo + "' ");

                                    str = "OfficeInChargeName= " + Modfunction.SQLSafeValue(OfficeInChargeName) + "";
                                    db.Update("tjms2",
                                              str,
                                              " TrxNo='" + strTrxNo + "' ");

                                    str = " CompanyName = " + Modfunction.SQLSafeValue(CompanyName) + "";
                                    db.Update("saco1",
                                              str
                                              );
                                }
                            }
                            Result = 1;
                        }
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #25
0
        public string VerifyGIN(string strAsnNo, string strConfirmBy)
        {
            string    Result     = "";
            string    strBarCode = GetBarCode("UserDefine01");
            DataTable dtWhScan   = GetSQLCommandReturnDT("Select *,(Select TrxNo from Impr1 Where Impr1." + strBarCode + " = WhScan.BarCode) AS ProductTrxNo,'' AS ComputeFlag from WhScan Where GoodsIssueNoteNo = " + Modfunction.SQLSafeValue(strAsnNo) + " AND ComfirmBy = " + Modfunction.SQLSafeValue(strConfirmBy));

            if (dtWhScan != null & dtWhScan.Rows.Count > 0)
            {
                DataTable dtImgi = GetSQLCommandReturnDT("Select TrxNo from Imgi1 Where GoodsIssueNoteNo = " + Modfunction.SQLSafeValue(dtWhScan.Rows[0]["GoodsIssueNoteNo"]) + "AND CustomerCode = " + Modfunction.SQLSafeValue(dtWhScan.Rows[0]["CustomerCode"]));
                if (dtImgi != null && dtImgi.Rows.Count > 0)
                {
                    dtImgi = GetSQLCommandReturnDT("select ProductTrxNo,SUM(case DimensionFlag when '1' then PackingQty when '2' then WholeQty else LooseQty end) DimQty,'' AS ComputeFlag from imgi2 Where TrxNo = " + Modfunction.SQLSafeValue(dtImgi.Rows[0]["TrxNo"]) + " Group by ProductTrxNo,DimensionFlag");
                    if (dtImgi != null && dtImgi.Rows.Count > 0)
                    {
                        int intScanQty, intImgiQty;
                        for (int intScanIndex = 0; intScanIndex < dtWhScan.Rows.Count; intScanIndex++)
                        {
                            if (dtWhScan.Rows[intScanIndex]["CompateFlag"].ToString() == "")
                            {
                                int intScanNewIndex = intScanIndex;
                                intScanQty = 0;
                                string strProductTrxNo = dtWhScan.Rows[intScanIndex]["ProductTrxNo"].ToString();
                                for (intScanNewIndex = intScanIndex; intScanNewIndex < dtWhScan.Rows.Count - 1; intScanNewIndex++)
                                {
                                    if (strProductTrxNo == dtWhScan.Rows[intScanNewIndex]["ProductTrxNo"].ToString() && dtWhScan.Rows[intScanNewIndex]["CompateFlag"].ToString() == "")
                                    {
                                        intScanQty = intScanQty + (int)dtWhScan.Rows[intScanNewIndex]["Qty"];
                                        dtWhScan.Rows[intScanNewIndex]["CompateFlag"] = "Y";
                                    }
                                }
                                intImgiQty = 0;
                                for (int intImgiIndex = 0; intImgiIndex < dtImgi.Rows.Count - 1; intImgiIndex++)
                                {
                                    if (strProductTrxNo == dtImgi.Rows[intImgiIndex]["ProductTrxNo"].ToString() && dtImgi.Rows[intImgiIndex]["CompateFlag"].ToString() == "")
                                    {
                                        dtImgi.Rows[intImgiIndex]["CompateFlag"] = "Y";
                                        intImgiQty = (int)dtImgi.Rows[intImgiIndex]["DimQty"];
                                    }
                                }
                                if (intScanQty != intImgiQty)
                                {
                                    return("The quantity of goods is wrong.");
                                }
                            }
                        }
                        for (int intImgiIndex = 0; intImgiIndex < dtImgi.Rows.Count - 1; intImgiIndex++)
                        {
                            if (dtImgi.Rows[intImgiIndex]["CompateFlag"].ToString() == "")
                            {
                                return("Some goods for ASN not scan.");
                            }
                        }
                    }
                    else
                    {
                        return("The Issue Note and Customer not mapping.");
                    }
                }
                else
                {
                    return("The Issue Note and Customer not mapping.");
                }
            }
            else
            {
                return("Not data for Scan.");
            }
            //VerifyGIN
            //  [Route("{GoodsIssueNoteNo}/{CustomerCode}/{BarCode}/{Qty}", "Get")]
            return(Result);
        }
예제 #26
0
        private string SaveImit(DataTable dtWhScan, Boolean blnSameCustomer)
        {
            string    Result = "";
            DataTable dtRec;
            DataTable dtImit = GetSQLCommandReturnDT("Select Top 0 from imit1");

            if (dtImit != null)
            {
                dtImit.Rows.Add(dtImit.NewRow());
                if (blnSameCustomer)
                {
                    dtImit.Rows[0]["CustomerCode"] = dtWhScan.Rows[0]["ProductCustomerCode"];
                }
                dtImit.Rows[0]["TransferDateTime"]    = DateTime.Today;
                dtImit.Rows[0]["CreateBy"]            = dtWhScan.Rows[0]["ConfirmBy"];
                dtImit.Rows[0]["UpdateBy"]            = dtWhScan.Rows[0]["ConfirmBy"];
                dtImit.Rows[0]["WorkStation"]         = "PDADriver_" + dtWhScan.Rows[0]["ConfirmBy"].ToString();
                dtImit.Rows[0]["GoodsTransferNoteNo"] = CreateGoodsReceiptNo(dtImit, "Imit");
                if (dtImit.Rows[0]["GoodsTransferNoteNo"] == null || dtImit.Rows[0]["GoodsTransferNoteNo"].ToString() == "")
                {
                    dtRec = GetSQLCommandReturnDT("Select NextGoodsTransferNo From Impa1");
                    dtImit.Rows[0]["GoodsTransferNoteNo"] = Modfunction.CheckNull(dtRec.Rows[0][0]);
                    string strNewNextGoodsTransferNo = CheckUpdateFieldLength(Modfunction.CheckNull(dtRec.Rows[0][0])).ToString();
                    GetSQLCommandReturnInt("Update Impa1 set NextGoodsTransferNo = '" + Modfunction.SQLSafe(strNewNextGoodsTransferNo) + "'");
                }
                int intSaveResult = InsertTableRecordByDatatable("Imit1", dtImit);
                if (intSaveResult == -1)
                {
                    return("Confirm unsuccess.");
                }
                dtRec = GetSQLCommandReturnDT("Select Max(TrxNo) from Imit1 Where WorkStation = " + Modfunction.SQLSafeValue(dtImit.Rows[0]["WorkStation"]) + " AND CreateBy = " + Modfunction.SQLSafeValue(dtImit.Rows[0]["CreateBy"]));
                if (dtRec != null && dtRec.Rows.Count > 0)
                {
                    int       intTrxNo = Convert.ToInt32(dtRec.Rows[0][0]);
                    DataTable dtImit2  = GetSQLCommandReturnDT("Select Top 0 from Imit2 ");
                    dtImit2.Rows.Clear();
                    for (int intIndex = 0; intIndex < dtWhScan.Rows.Count; intIndex++)
                    {
                        dtRec = GetSQLCommandReturnDT("Select * from Impr1 Where TrxNo = " + Convert.ToInt32(dtWhScan.Rows[intIndex]["ProductTrxNo"]).ToString());
                        if (dtRec != null && dtRec.Rows.Count > 0)
                        {
                            dtImit2.Rows.Add(dtImit2.NewRow());
                            dtImit2.Rows[dtImit2.Rows.Count - 1]["TrxNo"]        = intTrxNo;
                            dtImit2.Rows[dtImit2.Rows.Count - 1]["LineItemNo"]   = dtImit2.Rows.Count;
                            dtImit2.Rows[dtImit2.Rows.Count - 1]["ProductTrxNo"] = dtRec.Rows[0]["TrxNo"];
                            dtImit2.Rows[dtImit2.Rows.Count - 1]["Weight"]       = Convert.ToDecimal(dtRec.Rows[0]["UnitWt"]) * Convert.ToInt32(dtWhScan.Rows[intIndex]["Qty"]);
                            dtImit2.Rows[dtImit2.Rows.Count - 1]["Volume"]       = Convert.ToDecimal(dtRec.Rows[0]["UnitVol"]) * Convert.ToInt32(dtWhScan.Rows[intIndex]["Qty"]);
                            if (dtRec.Rows[0]["DimensionFlag"] != null)
                            {
                                if (dtRec.Rows[0]["DimensionFlag"].ToString() == "1")
                                {
                                    dtImit2.Rows[dtImit2.Rows.Count - 1]["PackingQty"] = dtWhScan.Rows[intIndex]["Qty"];
                                    dtImit2.Rows[dtImit2.Rows.Count - 1]["WholeQty"]   = Convert.ToInt32(dtWhScan.Rows[intIndex]["Qty"]) * Convert.ToInt32(dtRec.Rows[0]["PackingPackageSize"]);
                                    dtImit2.Rows[dtImit2.Rows.Count - 1]["LooseQty"]   = Convert.ToInt32(dtImit2.Rows[dtImit2.Rows.Count - 1]["WholeQty"]) * Convert.ToInt32(dtRec.Rows[0]["WholePackageSize"]);
                                }
                                if (dtRec.Rows[0]["DimensionFlag"].ToString() == "2")
                                {
                                    dtImit2.Rows[dtImit2.Rows.Count - 1]["WholeQty"] = dtWhScan.Rows[intIndex]["Qty"];
                                    dtImit2.Rows[dtImit2.Rows.Count - 1]["LooseQty"] = Convert.ToInt32(dtImit2.Rows[dtImit2.Rows.Count - 1]["WholeQty"]) * Convert.ToInt32(dtRec.Rows[0]["WholePackageSize"]);
                                }
                                if (dtRec.Rows[0]["DimensionFlag"].ToString() == "3")
                                {
                                    dtImit2.Rows[dtImit2.Rows.Count - 1]["LooseQty"] = dtWhScan.Rows[intIndex]["Qty"];
                                }
                            }
                            dtImit2.Rows[dtImit2.Rows.Count - 1]["NewStoreNo"]       = dtWhScan.Rows[intIndex]["StoreNo"];
                            dtImit2.Rows[dtImit2.Rows.Count - 1]["NewWarehouseCode"] = dtWhScan.Rows[intIndex]["WarehouseCode"];
                            dtImit2.Rows[dtImit2.Rows.Count - 1]["StoreNo"]          = dtWhScan.Rows[intIndex]["OldStoreNo"];
                            dtImit2.Rows[dtImit2.Rows.Count - 1]["WarehouseCode"]    = dtWhScan.Rows[intIndex]["OldWarehouseCode"];
                        }
                    }
                    if (dtImit2 != null && dtImit2.Rows.Count > 0)
                    {
                        intSaveResult = InsertTableRecordByDatatable("Imit2", dtImit2);
                        if (intSaveResult == -1)
                        {
                            return("Confirm unsuccess.");
                        }
                    }
                }
                else
                {
                    Result = "Confirm Unsuccess.";
                }
                return(Result);
            }
            return(Result);
        }
예제 #27
0
파일: Aemp_Aido.cs 프로젝트: koala-v/TanTms
        public int UpdateAll_Aemp1WithAido1(Aemp_Aido request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection())
                {
                    if (request.UpdateAllString != null && request.UpdateAllString != "")
                    {
                        JArray ja = (JArray)JsonConvert.DeserializeObject(request.UpdateAllString);
                        if (ja != null)
                        {
                            for (int i = 0; i < ja.Count(); i++)
                            {
                                if (ja[i]["TableName"] == null || ja[i]["TableName"].ToString() == "")
                                {
                                    continue;
                                }
                                string strKey        = ja[i]["Key"].ToString();
                                string strTableName  = ja[i]["TableName"].ToString();
                                string strRemark     = "";
                                string strStatusCode = "";
                                if (ja[i]["Remark"] != null || ja[i]["Remark"].ToString() != "")
                                {
                                    strRemark = ja[i]["Remark"].ToString();
                                }
                                if (ja[i]["StatusCode"] != null || ja[i]["StatusCode"].ToString() != "")
                                {
                                    strStatusCode = ja[i]["StatusCode"].ToString();
                                }
                                if (strStatusCode.ToLower() == "cancel")
                                {
                                    string strJobNo = "";
                                    if (ja[i]["JobNo"] != null || ja[i]["JobNo"].ToString() != "")
                                    {
                                        strJobNo = ja[i]["JobNo"].ToString();
                                    }
                                    if (strJobNo != "")
                                    {
                                        int          intMaxLineItemNo = 1;
                                        List <Jmjm3> list1            = db.Select <Jmjm3>("Select Max(LineItemNo) LineItemNo from Jmjm3 Where JobNo = " + Modfunction.SQLSafeValue(strJobNo));
                                        if (list1 != null)
                                        {
                                            if (list1[0].LineItemNo > 0)
                                            {
                                                intMaxLineItemNo = list1[0].LineItemNo + 1;
                                            }
                                        }
                                        db.Insert(new Jmjm3
                                        {
                                            JobNo          = strJobNo,
                                            DateTime       = DateTime.Now,
                                            UpdateDatetime = DateTime.Now,
                                            LineItemNo     = intMaxLineItemNo,
                                            AutoFlag       = "N",
                                            StatusCode     = "CANCEL",
                                            UpdateBy       = ja[0]["DriverCode"] == null ? "" : Modfunction.SQLSafe(ja[0]["DriverCode"].ToString()),
                                            Remark         = Modfunction.SQLSafe(strRemark),
                                            Description    = ja[0]["CancelDescription"] == null ? "" : Modfunction.SQLSafe(ja[0]["CancelDescription"].ToString())
                                        });
                                        if (strTableName == "Aemp1")
                                        {
                                            db.Update(strTableName,
                                                      " Remark = '" + Modfunction.SQLSafe(strRemark) + "'",
                                                      " TrxNo='" + strKey + "'");
                                        }
                                        else if (strTableName == "Sido1")
                                        {
                                            db.Update(strTableName,
                                                      " Remark = '" + Modfunction.SQLSafe(strRemark) + "'",
                                                      " TrxNo='" + strKey + "'");
                                        }

                                        else
                                        {
                                            db.Update(strTableName,
                                                      " Remark = '" + Modfunction.SQLSafe(strRemark) + "'",
                                                      " DeliveryOrderNo='" + strKey + "'");
                                        }
                                    }
                                }
                                else
                                {
                                    if (strTableName == "Aemp1")
                                    {
                                        db.Update(strTableName,
                                                  " Remark = '" + Modfunction.SQLSafe(strRemark) + "',StatusCode = '" + strStatusCode + "',SignBy='" + Modfunction.CheckNull(request.SignBy) + "'",
                                                  " TrxNo='" + strKey + "'");
                                    }
                                    else if (strTableName == "Sido1")
                                    {
                                        db.Update(strTableName,
                                                  " Remark = '" + Modfunction.SQLSafe(strRemark) + "',StatusCode = '" + strStatusCode + "',SignBy='" + Modfunction.CheckNull(request.SignBy) + "'",
                                                  " TrxNo='" + strKey + "'");
                                    }
                                    else
                                    {
                                        db.Update(strTableName,
                                                  " Remark = '" + Modfunction.SQLSafe(strRemark) + "',StatusCode = '" + strStatusCode + "',SignBy='" + Modfunction.CheckNull(request.SignBy) + "'",
                                                  " DeliveryOrderNo='" + strKey + "'");
                                    }
                                }
                            }
                            Result = 1;
                        }
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #28
0
        public string VerifyGRNNew(string strAsn, string strConfirmBy)
        {
            string    Result = "";
            DataTable dtOmtx2, dtWhScan;
            string    strBarCodeColumn = GetBarCode("UserDefine01");

            dtWhScan = GetSQLCommandReturnDT("Select *,(Select ProductCode from Impr1 Where impr1. " + strBarCodeColumn + " = Whscan.BarCode) AS ProductCode,'' AS CompateFlag from WhScan Where AsnNo = " + Modfunction.SQLSafeValue(strAsn) + " AND ComfirmBy = " + Modfunction.SQLSafeValue(strConfirmBy));
            if (dtWhScan != null && dtWhScan.Rows.Count > 0)
            {
                dtOmtx2 = GetSQLCommandReturnDT("select SUM(case DimensionFlag when '1' then BalancePackingQty when '2' then BalanceWholeQty else BalanceLooseQty end) DimQty,ProductCode,'' AS ComputeFlag from Omtx2 Where TrxNo = (Select Top 1 TrxNo from Omtx1 Where AsnNo = " + Modfunction.SQLSafeValue(strAsn) + ") Group BY ProductCode");
                if (dtOmtx2 != null && dtOmtx2.Rows.Count > 0)
                {
                    Result = VerifyGRN(dtWhScan, dtOmtx2);
                }
            }
            return(Result);
        }
예제 #29
0
        public int Update_Imgr2_QtyRemark(Imgr request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
                {
                    if (request.QtyFieldName == "PackingQty")
                    {
                        Result = db.Update <Imgr2>(
                            new
                        {
                            PackingQty = request.QtyRemarkQty,
                            UpdateBy   = request.UserID
                        },
                            p => p.TrxNo == int.Parse(request.TrxNo) && p.LineItemNo == int.Parse(request.LineItemNo)
                            );
                        Result = db.Update("Impm1", "BalancePackingQty = " + request.QtyRemarkQty
                                           ,
                                           " BatchNo = " + Modfunction.SQLSafeValue(request.GoodsReceiptNoteNo) + " AND BatchLineItemNo = " + Modfunction.SQLSafeValue(request.LineItemNo)
                                           );
                    }
                    else if (request.QtyFieldName == "WholeQty")
                    {
                        Result = db.Update <Imgr2>(
                            new
                        {
                            WholeQty = request.QtyRemarkQty,
                            UpdateBy = request.UserID
                        },
                            p => p.TrxNo == int.Parse(request.TrxNo) && p.LineItemNo == int.Parse(request.LineItemNo)
                            );
                        Result = db.Update("Impm1", "BalanceWholeQty = " + request.QtyRemarkQty
                                           ,
                                           " BatchNo = " + Modfunction.SQLSafeValue(request.GoodsReceiptNoteNo) + " AND BatchLineItemNo = " + Modfunction.SQLSafeValue(request.LineItemNo)
                                           );
                    }
                    else
                    {
                        Result = db.Update <Imgr2>(
                            new
                        {
                            LooseQty = request.QtyRemarkQty,
                            UpdateBy = request.UserID
                        },
                            p => p.TrxNo == int.Parse(request.TrxNo) && p.LineItemNo == int.Parse(request.LineItemNo)
                            );
                        Result = db.Update("Impm1", "BalanceLooseQty = " + request.QtyRemarkQty
                                           ,
                                           " BatchNo = " + Modfunction.SQLSafeValue(request.GoodsReceiptNoteNo) + " AND BatchLineItemNo = " + Modfunction.SQLSafeValue(request.LineItemNo)
                                           );
                    }
                    Result = db.Update <Imgr1>(" Remark=isnull(Remark,'') + (case isnull(Remark,'') when '' then '' else char(13)+char(10)  end) + " + Modfunction.SQLSafeValue(request.QtyRemark) + ",UpdateDateTime = getdate(),UpdateBy = " + Modfunction.SQLSafeValue(request.UserID)
                                               ,
                                               " TrxNo = " + request.TrxNo
                                               );
                }
            }
            catch { throw; }
            return(Result);
        }
예제 #30
0
        public int insert_tjms5(Tobk request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("TMS"))
                {
                    //if (request.UpdateAllString != null && request.UpdateAllString != "")
                    //{
                    //    JArray ja = (JArray)JsonConvert.DeserializeObject(request.UpdateAllString);
                    //    if (ja != null)
                    //    {
                    //        for (int i = 0; i < ja.Count(); i++)
                    //        {

                    if (request.TrxNo.Length > 0)
                    {
                        int    TrxNo                    = Modfunction.ReturnZero(request.TrxNo.ToString());
                        string EquipmentType            = Modfunction.SQLSafeValue(Modfunction.CheckNull(request.EquipmentType));
                        string EquipmentTypeDescription = Modfunction.SQLSafeValue(Modfunction.CheckNull(request.EquipmentTypeDescription));
                        string ContainerNo              = Modfunction.SQLSafeValue(Modfunction.CheckNull(request.ContainerNo));
                        string CargoDescription         = Modfunction.SQLSafeValue(Modfunction.CheckNull(request.CargoDescription));
                        double Volume                   = Modfunction.ReturnDobule(request.Volume);
                        double ChargeWeight             = Modfunction.ReturnDobule(request.ChargeWeight);
                        double ChgWtRoundUp             = Modfunction.ReturnDobule(request.ChgWtRoundUp);
                        string VehicleNo                = Modfunction.SQLSafeValue(Modfunction.CheckNull(request.VehicleNo));
                        string startDateTime            = "(select  Top 1 ISNULL(StartDateTime,NULL) AS StartDateTime  from tjms4 where TrxNo=" + TrxNo + ")  ";
                        string endDateTime              = "(select  Top 1  ISNULL(EndDateTime,NULL) AS EndDateTime  from tjms4 where TrxNo=" + TrxNo + ")";
                        string strSql                   = "";



                        int          intMaxLineItemNo = 1;
                        List <Tjms5> list1            = db.Select <Tjms5>("Select Max(LineItemNo) LineItemNo from Tjms5 Where TrxNo = " + TrxNo);
                        if (list1 != null)
                        {
                            if (list1[0].LineItemNo > 0)
                            {
                                intMaxLineItemNo = list1[0].LineItemNo + 1;
                            }
                        }


                        if (intMaxLineItemNo != 0)
                        {
                            strSql = "insert into tjms5 (" +
                                     " TrxNo ," +
                                     " LineItemNo ," +
                                     " EquipmentType ," +
                                     " EquipmentTypeDescription  ," +
                                     " ContainerNo ," +
                                     " CargoDescription  ," +
                                     " Volume ," +
                                     " ChargeWeight ," +
                                     " ChgWtRoundUp ," +
                                     " editflag ," +
                                     " VehicleNo  " +

                                     "  )" +
                                     "values( " +
                                     TrxNo + " , " +
                                     intMaxLineItemNo + " , " +
                                     EquipmentType + " , " +
                                     EquipmentTypeDescription + " , " +
                                     ContainerNo + " , " +
                                     CargoDescription + " , " +
                                     Volume + " , " +
                                     ChargeWeight + " , " +
                                     ChgWtRoundUp + " , " +
                                     "(Select isnull(editFlag,'') From tovt1 where   VehicleTypeDescription =" + EquipmentTypeDescription + ")," +
                                     VehicleNo + "  " +

                                     ") ";
                            db.ExecuteSql(strSql);


                            strSql = "  update tjms2 set ChargeWeight = (select sum(ChgWtRoundUp) from tjms5 where TrxNo=" + TrxNo + ")  Where LineItemNo =1 and TrxNo=" + TrxNo + " ";
                            db.ExecuteSql(strSql);
                        }
                    }

                    //    }
                    //}
                    Result = 1;

                    //}
                }
            }
            catch { throw; }
            return(Result);
        }