Beispiel #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);
        }
 private void grd_sasr1_SelectionChanged(object sender, EventArgs e)
 {
     if (grd_sasr1.RowCount > 0)
     {
         if (grd_sasr1.CurrentRow != null)
         {
             {
                 txt_RequestDes.Text              = Modfunction.CheckNull(grd_sasr1.Rows[grd_sasr1.CurrentRow.Index].Cells["RequestDescription"].Value).ToString().Replace("\n", "\r\n");
                 txt_TestSummary.Text             = grd_sasr1.Rows[grd_sasr1.CurrentRow.Index].Cells["TestSummary"].Value.ToString().Replace("\n", "\r\n");
                 this.txt_RequestDescription.Text = grd_sasr1.Rows[grd_sasr1.CurrentRow.Index].Cells["RequestDescription"].Value.ToString().Replace("\n", "\r\n");
                 txt_ProgramingSummary.Text       = Modfunction.CheckNull(grd_sasr1.Rows[grd_sasr1.CurrentRow.Index].Cells["ProgrammingSummary"].Value).ToString().Replace("\n", "\r\n");
             }
         }
     }
 }
        public void SaveInsertGroupNameEvent(string strInsertNextGroupCode, int intLineItem, string strJobNo, string strUserId)
        {
            List <Jmjm3> ResultJmjm3 = null;
            List <Jmeg2> ResultJmeg2 = null;


            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("TMS"))
                {
                    int    intMaxLineItemNo = 0;
                    string strSelectJmjm3   = "Select Max(LineItemNo)  as  LineItemNo from Jmjm3 Where JobNo = '" + strJobNo + "'";
                    ResultJmjm3 = db.Select <Jmjm3>(strSelectJmjm3);
                    if (ResultJmjm3.Count > 0)
                    {
                        intMaxLineItemNo = ResultJmjm3[0].LineItemNo + 1;
                    }

                    string strSelectJmeg2 = "Select EventCode from Jmeg2 Where GroupCode = '" + strInsertNextGroupCode + "'";
                    ResultJmeg2 = db.Select <Jmeg2>(strSelectJmeg2);
                    if (ResultJmeg2.Count > 0)
                    {
                        if (intLineItem > 0)
                        {
                            string StrUpdateJmjm7 = "Update Jmjm7 Set JobLineItemNo = JobLineItemNo + " + ResultJmeg2.Count + " Where JobNo = '" + strJobNo + "' AND JobLineItemNo > " + intLineItem;
                            db.ExecuteSql(StrUpdateJmjm7);

                            string StrUpdateJmjm4 = "Update Jmjm4 Set JobLineItemNo = JobLineItemNo + " + ResultJmeg2.Count + " Where JobNo = '" + strJobNo + "' AND JobLineItemNo > " + intLineItem;
                            db.ExecuteSql(StrUpdateJmjm4);

                            string StrUpdateJmjm3 = "update Jmjm3 Set LineItemNo = LineItemNo + " + ResultJmeg2.Count + " Where JobNo = '" + strJobNo + "' AND LineItemNo > " + intLineItem;
                            db.ExecuteSql(StrUpdateJmjm3);

                            intMaxLineItemNo = intLineItem + 1;
                        }
                        for (int i = 0; i < ResultJmeg2.Count; i++)
                        {
                            string StrInsertJmjm3 = "INSERT INTO Jmjm3 (JobNo, LineItemNo,EventCode, Description, ShowETrackFlag,Remark,UpdateBy, UpdateDateTime) " + "Select '" + strJobNo + "'," + intMaxLineItemNo + ",EventCode,Description,EtrackFlag,Remark,'" + strUserId + "', getdate() from Jmje1 Where  EventCode= '" + ResultJmeg2[i].EventCode + "'";
                            db.ExecuteSql(StrInsertJmjm3);
                            UpdateEventListToJmjm4(Modfunction.CheckNull(ResultJmeg2[i].EventCode), intMaxLineItemNo, strJobNo);
                            intMaxLineItemNo = intMaxLineItemNo + 1;
                        }
                    }
                }
            }
            catch { throw; }
        }
Beispiel #4
0
 public List <Impa1> Get_Impa1_List()
 {
     try
     {
         using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
         {
             string strSQL = "Select  isNull(ShowCycleCountAppFlag,'N') as ShowCycleCountAppFlag,BarCodeField ,isnull(AppTallyConfirmStatus,'') as AppTallyConfirmStatus, isnull(AppPutawayConfirmStatus,'') as AppPutawayConfirmStatus ,isnull(AppPickConfirmStatus,'') as AppPickConfirmStatus ,isnull(AppIssueVerifyStatus,'') as AppIssueVerifyStatus  from Impa1";
             ResultImpa1             = db.Select <Impa1>(strSQL);
             AppTallyConfirmStatus   = Modfunction.CheckNull(ResultImpa1[0].AppTallyConfirmStatus);
             AppPutawayConfirmStatus = Modfunction.CheckNull(ResultImpa1[0].AppPutawayConfirmStatus);
             AppPickConfirmStatus    = Modfunction.CheckNull(ResultImpa1[0].AppPickConfirmStatus);
             AppIssueVerifyStatus    = Modfunction.CheckNull(ResultImpa1[0].AppIssueVerifyStatus);
         }
     }
     catch { throw; }
     return(ResultImpa1);
 }
Beispiel #5
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);
        }
Beispiel #6
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("");
 }
Beispiel #7
0
        public int Update_verify_imgi1(Imgi request)
        {
            Get_Impa1_List();
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
                {
                    if (Modfunction.CheckNull(AppIssueVerifyStatus) != "")
                    {
                        Result = db.Update <Imgi1>(
                            new
                        {
                            StatusCode = AppIssueVerifyStatus
                        },
                            p => p.TrxNo == int.Parse(request.TrxNo)
                            );
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
        public int confirm_Aemp1WithAido1(Aemp_Aido request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection())
                {
                    if (request.TableName == "Aemp1")
                    {
                        db.Update(request.TableName,
                                  " Remark = '" + request.Remark + "',StatusCode = 'POD',ActualPickUpDateTime=getdate(),SignBy='" + Modfunction.CheckNull(request.SignBy) + "'",
                                  " TrxNo='" + request.Key + "'");
                    }
                    else if (request.TableName == "Sido1")
                    {
                        db.Update(request.TableName,
                                  " Remark = '" + request.Remark + "',StatusCode = 'POD',SignBy='" + Modfunction.CheckNull(request.SignBy) + "'",
                                  " TrxNo='" + request.Key + "'");
                    }
                    else
                    {
                        db.Update(request.TableName,
                                  "  Remark = '" + request.Remark + "',StatusCode = 'POD',ActualDeliveryDateTime=getdate(),SignBy='" + Modfunction.CheckNull(request.SignBy) + "'",
                                  "  DeliveryOrderNo='" + request.Key + "'");
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
Beispiel #10
0
        public int LoginCheck(Wms_Login request)
        {
            int Result = -1;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("WMS"))
                {
                    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 strSqlSaus1 = "";
                                string strUserId   = ja[i]["UserId"].ToString();
                                string strPassword = ja[i]["Password"].ToString();
                                //strSqlSaus1 = "Select count(*) From Saus1 Where UserId='" + Modfunction.CheckNull(strUserId) + "' And Password='******'";
                                strSqlSaus1 = "Select count(*) From Saus1 Where UserId='" + Modfunction.CheckNull(strUserId) + "'";
                                Result      = db.Scalar <int>(strSqlSaus1);
                            }
                        }
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
        public void UpdateEventListToJmjm4(string strEventCode, int intJobLineItemNo, string strJobNo)
        {
            List <Jmje2> ResultJmje2 = null;

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("TMS"))
                {
                    if (strEventCode != null && strEventCode != "")
                    {
                        string strSelectJmje2 = "Select * from Jmje2 Where EventCode = '" + strEventCode + "'";
                        ResultJmje2 = db.Select <Jmje2>(strSelectJmje2);
                        if (ResultJmje2.Count > 0)
                        {
                            int intLineItemNo = 1;
                            for (int i = 0; i < ResultJmje2.Count; i++)
                            {
                                string insertJmjm4 = "Insert Into Jmjm4(JobNo,JobLineItemNo,EventLineItemNo,LineItemNo,DoneFlag,ItemName,MobileUser,Remark) values (" +
                                                     "'" + strJobNo + "'," + intJobLineItemNo + "," + ResultJmje2[i].LineItemNo + "," + intLineItemNo + ",NULL,'" + Modfunction.CheckNull(ResultJmje2[i].ItemName) + "','" + Modfunction.CheckNull(ResultJmje2[i].MobileUser) + "', '' )";
                                intLineItemNo = intLineItemNo + 1;
                                db.ExecuteSql(insertJmjm4);
                            }
                        }
                    }
                }
            }
            catch { throw; }
        }
Beispiel #12
0
        private string CreateGoodsReceiptNo(DataTable dt, string strNumberType)
        {
            string functionReturnValue = null;
            int    intI                 = 0;
            string m_strJobSeqNo        = "";
            string m_strPullFrom        = "";
            string m_strUpdateNextField = "";
            int    intMonth             = 0;
            string strGoodsReceiptNo    = null;
            int    intYear              = 0;

            string[]  strArr           = null;
            DataTable dtRec            = null;
            DataTable dtRec2           = null;
            string    m_SQlCommandText = null;

            functionReturnValue = "";
            m_SQlCommandText    = "Select * From Sanm1 Where NumberType = '" + strNumberType + "' Order By JobType Desc";
            dtRec = GetSQLCommandReturnDT(m_SQlCommandText);
            if ((dtRec != null))
            {
                if (dtRec.Rows.Count > 0)
                {
                    if (dtRec.Rows[0]["Cycle"] == null)
                    {
                        return(functionReturnValue);
                    }
                    //Cycle = Continuous
                    if (dtRec.Rows[0]["Cycle"].ToString() == "C")
                    {
                        m_strPullFrom = "NextNo";
                        m_strJobSeqNo = Modfunction.CheckNull(dtRec.Rows[0]["NextNo"]);
                        //Cycle = Month
                    }
                    else if (Modfunction.CheckNull(dtRec.Rows[0]["Cycle"]) == "M")
                    {
                        intMonth         = DateTime.Now.Month;
                        intYear          = DateTime.Now.Year;
                        m_SQlCommandText = "Select * From Sanm2 Where TrxNo = " + Modfunction.CheckNull(dtRec.Rows[0]["TrxNo"]) + " And Year = '" + intYear + "'";
                        dtRec2           = GetSQLCommandReturnDT(m_SQlCommandText);
                        if ((dtRec2 != null))
                        {
                            if (dtRec2.Rows.Count > 0)
                            {
                                switch (intMonth)
                                {
                                case 1:
                                    m_strPullFrom = "Mth01NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth01NextNo"].ToString();
                                    break;

                                case 2:
                                    m_strPullFrom = "Mth02NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth02NextNo"].ToString();
                                    break;

                                case 3:
                                    m_strPullFrom = "Mth03NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth03NextNo"].ToString();
                                    break;

                                case 4:
                                    m_strPullFrom = "Mth04NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth04NextNo"].ToString();
                                    break;

                                case 5:
                                    m_strPullFrom = "Mth05NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth05NextNo"].ToString();
                                    break;

                                case 6:
                                    m_strPullFrom = "Mth06NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth06NextNo"].ToString();
                                    break;

                                case 7:
                                    m_strPullFrom = "Mth07NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth07NextNo"].ToString();
                                    break;

                                case 8:
                                    m_strPullFrom = "Mth08NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth08NextNo"].ToString();
                                    break;

                                case 9:
                                    m_strPullFrom = "Mth09NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth09NextNo"].ToString();
                                    break;

                                case 10:
                                    m_strPullFrom = "Mth10NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth10NextNo"].ToString();
                                    break;

                                case 11:
                                    m_strPullFrom = "Mth11NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth11NextNo"].ToString();
                                    break;

                                case 12:
                                    m_strPullFrom = "Mth12NextNo";
                                    m_strJobSeqNo = dtRec2.Rows[0]["Mth12NextNo"].ToString();
                                    break;
                                }
                            }
                            else
                            {
                                return(functionReturnValue);
                            }
                        }
                        //No flag = Year
                    }
                    else if (Modfunction.CheckNull(dtRec.Rows[0]["Cycle"]) == "Y")
                    {
                        intYear          = DateTime.Now.Year;
                        m_SQlCommandText = "Select YearNextNo From Sanm2 Where TrxNo = " + Modfunction.CheckNull(dtRec.Rows[0]["TrxNo"]) + " And Year = '" + intYear + "'";
                        dtRec2           = GetSQLCommandReturnDT(m_SQlCommandText);
                        if ((dtRec2 != null))
                        {
                            if (dtRec2.Rows.Count > 0)
                            {
                                m_strPullFrom = "YearNextNo";
                                m_strJobSeqNo = Modfunction.CheckNull(dtRec2.Rows[0]["YearNextNo"]);
                            }
                            else
                            {
                                return(functionReturnValue);
                            }
                        }
                    }
                    strGoodsReceiptNo = "";
                    if (Modfunction.CheckNull(dtRec.Rows[0]["Prefix"]) != "")
                    {
                        strArr = System.Text.RegularExpressions.Regex.Split(dtRec.Rows[0]["Prefix"].ToString(), ",");
                        for (intI = 0; intI <= strArr.Length; intI++)
                        {
                            strGoodsReceiptNo = strGoodsReceiptNo + ReturnPrefixSuffix(strArr[intI], dt);
                        }
                    }
                    strGoodsReceiptNo = strGoodsReceiptNo + m_strJobSeqNo;
                    // & "00"
                    if (Modfunction.CheckNull(dtRec.Rows[0]["Suffix"]).Trim().Length > 0)
                    {
                        strArr = null;
                        strArr = System.Text.RegularExpressions.Regex.Split(dtRec.Rows[0]["Suffix"].ToString(), ",");
                        for (intI = 0; intI <= strArr.Length; intI++)
                        {
                            strGoodsReceiptNo = strGoodsReceiptNo + ReturnPrefixSuffix(strArr[intI], dt);
                        }
                    }
                    functionReturnValue = strGoodsReceiptNo;
                    //120629DC NET3983
                    if (functionReturnValue.Length > 20)
                    {
                        functionReturnValue = functionReturnValue.Substring(functionReturnValue.Length - 20, 20);
                    }
                    m_strUpdateNextField = CheckUpdateFieldLength(m_strJobSeqNo);
                    //Cycle = Continuous
                    if (Modfunction.CheckNull(dtRec.Rows[0]["Cycle"]) == "C")
                    {
                        m_SQlCommandText = "Update Sanm1 Set " + m_strPullFrom + " = '" + Modfunction.SQLSafe(m_strUpdateNextField) + "' Where TrxNo = " + Modfunction.CheckNull(dtRec.Rows[0]["TrxNo"]);
                        //Add 1 For Next Job No
                    }
                    else
                    {
                        m_SQlCommandText = "Update Sanm2 Set " + m_strPullFrom + " = '" + Modfunction.SQLSafe(m_strUpdateNextField) + "' Where TrxNo = " + Modfunction.CheckNull(dtRec.Rows[0]["TrxNo"]) + " And Year = '" + intYear + "'";
                    }
                    GetSQLCommandReturnInt(m_SQlCommandText);
                }
            }
            return(functionReturnValue);
        }
Beispiel #13
0
        private string ReturnPrefixSuffix(string strPrefixSuffix, DataTable dtImgr)
        {
            string functionReturnValue = null;

            functionReturnValue = "";
            // ERROR: Not supported in C#: OnErrorStatement

            int intMth = 0;

            switch (strPrefixSuffix)
            {
            case "MM":
                functionReturnValue = DateTime.Now.Month.ToString();
                break;

            case "M":
                intMth = DateTime.Now.Month;
                if (intMth == 10)
                {
                    functionReturnValue = "O";
                }
                else if (intMth == 11)
                {
                    functionReturnValue = "N";
                }
                else if (intMth == 12)
                {
                    functionReturnValue = "D";
                }
                else
                {
                    functionReturnValue = intMth.ToString();
                }
                break;

            case "YY":
                functionReturnValue = DateTime.Now.ToString("yy");
                break;

            case "Y":
                functionReturnValue = DateTime.Now.ToString("yy").Substring(1, 1);
                break;

            case "NN":
                functionReturnValue = "00";
                break;

            case "N":
                functionReturnValue = "0";
                break;

            case "CUST":
                //120629DC NET3983
                functionReturnValue = Modfunction.CheckNull(dtImgr.Rows[0]["CustomerCode"]);
                break;

            default:
                if (strPrefixSuffix.Substring(0, 1) == "F")
                {
                    functionReturnValue = strPrefixSuffix.Substring(1);
                }
                break;
            }
            return(functionReturnValue);
        }
        public int UpdateDone(Update_Done request)
        {
            int          Result              = -1;
            List <Jmjm4> ResultJmjm4         = null;
            List <Jmjm4> ResultJmjm4DoneFlag = null;
            List <Jmje2> ResultJmje2         = null;
            string       strEventCode        = "";
            string       strSqlJmje2         = "";

            try
            {
                using (var db = DbConnectionFactory.OpenDbConnection("TMS"))
                {
                    if (request.DoneDateTime != DateTime.MinValue)
                    {
                        Result = db.Update <Jmjm4>(new { DoneDateTime = request.DoneDateTime, DoneFlag = request.DoneFlag, Remark = request.Remark, ContainerNo = request.ContainerNo }, p => p.JobNo == request.JobNo && p.JobLineItemNo == request.JobLineItemNo && p.LineItemNo == request.LineItemNo);
                    }
                    else
                    {
                        Result = db.Update <Jmjm4>(new { DoneFlag = request.DoneFlag, Remark = request.Remark, ContainerNo = request.ContainerNo }, p => p.JobNo == request.JobNo && p.JobLineItemNo == request.JobLineItemNo && p.LineItemNo == request.LineItemNo);
                    }
                    if (Result > 0)
                    {
                        InsertContainerNo(request);
                    }



                    string strSql = "select (Select  EventCode From jmjm3 where jmjm3.jobno=jmjm4.jobno and jmjm3.LineItemNo =jmjm4.JobLineItemNo ) as EventCode,* from jmjm4 where jobno ='" + request.JobNo + "'And JobLineItemNo='" + request.JobLineItemNo + "' And LineItemNo='" + request.LineItemNo + "' and PhoneNumber='" + request.PhoneNumber + "' ";
                    ResultJmjm4 = db.Select <Jmjm4>(strSql);
                    if (ResultJmjm4.Count > 0)
                    {
                        strEventCode = Modfunction.CheckNull(ResultJmjm4[0].EventCode);
                        strSqlJmje2  = "Select  InsertNextEventCode ,InsertNextEventGroup From jmje2 Where EventCode='" + strEventCode + "' And LineItemNo in (Select EventLineItemNo From Jmjm4 Where  jobno ='" + request.JobNo + "'And JobLineItemNo='" + request.JobLineItemNo + "' And LineItemNo='" + request.LineItemNo + "' )";
                        ResultJmje2  = db.Select <Jmje2>(strSqlJmje2);
                        if (ResultJmje2.Count > 0)
                        {
                            if (Modfunction.CheckNull(ResultJmje2[0].InsertNextEventCode) == "" && Modfunction.CheckNull(ResultJmje2[0].InsertNextEventGroup) == "")
                            {
                                bool   BlnDoneFlag      = true;
                                string strJmjm4DoneFlag = "select DoneFlag  from jmjm4 where jobno ='" + request.JobNo + "'And JobLineItemNo='" + request.JobLineItemNo + "' and PhoneNumber='" + request.PhoneNumber + "' ";
                                ResultJmjm4DoneFlag = db.Select <Jmjm4>(strJmjm4DoneFlag);
                                if (ResultJmjm4DoneFlag.Count > 0)
                                {
                                    for (int i = 0; i < ResultJmjm4DoneFlag.Count; i++)
                                    {
                                        if (ResultJmjm4DoneFlag[i].DoneFlag == "N")
                                        {
                                            BlnDoneFlag = false;
                                            break;
                                        }
                                    }

                                    if (BlnDoneFlag == true)
                                    {
                                        string strUpdateStautsCode;
                                        strUpdateStautsCode = "Update  Jmjm3 Set StatusCode ='CMP' Where JobNo ='" + request.JobNo + "' And LineItemNo ='" + request.JobLineItemNo + "'";
                                        db.ExecuteSql(strUpdateStautsCode);
                                    }
                                }
                            }
                            else
                            {
                                if (Modfunction.CheckNull(ResultJmje2[0].InsertNextEventCode).Length > 0)
                                {
                                    SaveInsertNextEventCode(Modfunction.CheckNull(ResultJmje2[0].InsertNextEventCode), request.JobLineItemNo, request.JobNo, request.PhoneNumber);
                                }


                                if (Modfunction.CheckNull(ResultJmje2[0].InsertNextEventGroup).Length > 0)
                                {
                                    SaveInsertGroupNameEvent(Modfunction.CheckNull(ResultJmje2[0].InsertNextEventGroup), request.JobLineItemNo, request.JobNo, request.PhoneNumber);
                                }

                                string strUpdateStautsCode;
                                strUpdateStautsCode = "Update  Jmjm3 Set StatusCode ='CMP' Where JobNo ='" + request.JobNo + "' And LineItemNo ='" + request.JobLineItemNo + "'";
                                db.ExecuteSql(strUpdateStautsCode);
                            }
                        }
                    }
                }
            }
            catch { throw; }
            return(Result);
        }
Beispiel #15
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);
        }
Beispiel #16
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);
        }
Beispiel #17
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);
        }
Beispiel #18
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);
        }