コード例 #1
0
        protected void btnBatch_Click(object sender, EventArgs e)
        {
            if (txtAddMo.Text == "")
            {
                return;
            }
            user_id = getUserName();
            string mo_id  = txtAddMo.Text.ToUpper();
            string strSql = "";
            string result = "";

            //strSql = "Delect From mo_BatchPrint Where within_code='" + within_code + "' AND user_id='" + user_id + "'";
            strSql = "Select mo_id From mo_BatchPrint Where within_code='" + within_code + "' AND user_id='" + user_id + "' AND mo_id='" + mo_id + "'";
            DataTable tbMoFind = sh.ExecuteSqlReturnDataTable(strSql);

            if (tbMoFind.Rows.Count == 0)
            {
                strSql = string.Format(@"INSERT INTO mo_BatchPrint( 
                              within_code,mo_id,user_id,crusr,crtim)
                              VALUES ('{0}','{1}','{2}','{3}',GETDATE()) "
                                       , within_code, mo_id, user_id, user_id);
                result = sh.ExecuteSqlUpdate(strSql);
                if (result != "")
                {
                    StrHlp.WebMessageBox(this.Page, result);
                }
                else
                {
                    txtAddMo.Text = "";
                    txtAddMo.Focus();
                }
            }
            LoadBatchMo();
        }
コード例 #2
0
ファイル: Sa_Mo_ApproveColor.aspx.cs プロジェクト: cfmis/cfw
        /// 儲存記錄
        private void SaveRec()
        {
            if (txtMo.Text == "")
            {
                StrHlp.WebMessageBox(this.Page, "制單編號不能為空!");
                txtMo.Focus();
                return;
            }
            string result_str   = "";
            string strSql       = "";
            string prd_mo       = txtMo.Text.ToUpper();
            string prd_rmk      = txtRmk.Text;
            string approve_flag = "0";


            strSql += string.Format(@"INSERT INTO mo_approvecolor (prd_mo,prd_rmk,crusr,crtim,approve_flag)
                    VALUES ('{0}','{1}','{2}',GETDATE(),'{3}')"
                                    , prd_mo, prd_rmk, user_id, approve_flag);
            result_str = sh.ExecuteSqlUpdate(strSql);//更新明細記錄
            if (result_str != "")
            {
                //Response.Write(String.Format("<script text='text/javascript'>alert('{0}')</script>", result_str));
                StrHlp.WebMessageBox(this.Page, result_str);
            }
            else
            {
                LoadData();
            }
        }
コード例 #3
0
        protected void deleteProcess(HttpContext context)
        {
            string   result = "";
            BasePage bp     = new BasePage();

            string strSql = "";

            strSql += string.Format(@" SET XACT_ABORT  ON ");
            strSql += string.Format(@" BEGIN TRANSACTION ");
            if (context.Request["arrange_id"] != null)//刪除一筆記錄
            {
                string arrange_id = context.Request["arrange_id"];
                strSql += string.Format(@"Delete From dgcf_pad.dbo.product_arrange Where arrange_id='{0}'", arrange_id);
            }
            else//刪除部門當日所有記錄
            {
                string Prd_dep      = context.Request["Prd_dep"];
                string Arrange_date = context.Request["Arrange_date"];
                strSql += string.Format(@"Delete From dgcf_pad.dbo.product_arrange Where prd_dep='{0}' And now_date='{1}'", Prd_dep, Arrange_date);
            }
            //strSql += string.Format(@" IF @@error <> 0 ");
            //strSql += string.Format(@" ROLLBACK TRANSACTION ");
            //strSql += string.Format(@" ELSE ");
            strSql += string.Format(@" COMMIT TRANSACTION ");

            result = sh.ExecuteSqlUpdate(strSql);
            if (result == "")
            {
                result = "記錄已刪除!";
            }
            //return result;
            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
            context.Response.End();
        }
コード例 #4
0
        protected string updateProcess(HttpContext context)
        {
            string para   = context.Request["param"];
            JArray ja     = (JArray)JsonConvert.DeserializeObject(para);
            string result = "";
            string msg    = "";
            string id     = ja[0]["id"].ToString().Trim();

            if (id == null || id == "")
            {
                id = "";
            }

            float  order_qty = Convert.ToSingle(ja[0]["order_qty"].ToString());
            string sytim     = DateTime.Now.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss");
            string uname     = bp.getUserName();
            string strSql    = "";

            if (id == "")
            {
                string dat = System.DateTime.Now.ToString("yyyyMMdd HH:mm:ss");
                id     = "OD" + dat.Substring(0, 8) + dat.Substring(9, 2) + dat.Substring(12, 2) + dat.Substring(15, 2);
                strSql = "Insert Into so_cust_order (id,pono,order_date,custcode,season,own,brand,cust_item,cust_item_cdesc,cust_color,cust_size,cust_style" +
                         ",order_qty,unit,req_date,cf_prd_item,cf_color,cf_size,test_item,packing,crusr,crtim)" +
                         " Values ("
                         + "'" + id + "','" + ja[0]["pono"].ToString().Trim() + "','" + ja[0]["order_date"].ToString().Trim() + "','" + ja[0]["custcode"].ToString().Trim()
                         + "','" + ja[0]["season"].ToString().Trim() + "','" + ja[0]["own"].ToString().Trim() + "','" + ja[0]["brand"].ToString().Trim()
                         + "','" + ja[0]["cust_item"].ToString().Trim() + "','" + ja[0]["cust_item_cdesc"].ToString().Trim() + "','" + ja[0]["cust_color"].ToString().Trim()
                         + "','" + ja[0]["cust_size"].ToString().Trim() + "','" + ja[0]["cust_style"].ToString().Trim() + "','" + order_qty + "','" + ja[0]["unit"].ToString().Trim()
                         + "','" + ja[0]["req_date"].ToString().Trim() + "','" + ja[0]["cf_prd_item"].ToString().Trim() + "','" + ja[0]["cf_color"].ToString().Trim()
                         + "','" + ja[0]["cf_size"].ToString().Trim() + "','" + ja[0]["test_item"].ToString().Trim() + "','" + ja[0]["packing"].ToString().Trim()
                         + "','" + uname + "','" + sytim
                         + "')";
            }
            else
            {
                strSql = "Update so_cust_order Set "
                         + "pono='" + ja[0]["pono"].ToString().Trim() + "'" + ",order_date='" + ja[0]["order_date"].ToString().Trim() + "'" + ",custcode='" + ja[0]["custcode"].ToString().Trim() + "'"
                         + ",season='" + ja[0]["season"].ToString().Trim() + "'" + ",own='" + ja[0]["own"].ToString().Trim() + "'" + ",brand='" + ja[0]["brand"].ToString().Trim() + "'"
                         + ",cust_item='" + ja[0]["cust_item"].ToString().Trim() + "'" + ",cust_item_cdesc='" + ja[0]["cust_item_cdesc"].ToString().Trim() + "'" + ",cust_color='" + ja[0]["cust_color"].ToString().Trim() + "'"
                         + ",cust_size='" + ja[0]["cust_size"].ToString().Trim() + "'" + ",cust_style='" + ja[0]["cust_style"].ToString().Trim() + "'" + ",order_qty='" + order_qty + "'" + ",unit='" + ja[0]["unit"].ToString().Trim() + "'"
                         + ",req_date='" + ja[0]["req_date"].ToString().Trim() + "'" + ",cf_prd_item='" + ja[0]["cf_prd_item"].ToString().Trim() + "'" + ",cf_color='" + ja[0]["cf_color"].ToString().Trim() + "'"
                         + ",cf_size='" + ja[0]["cf_size"].ToString().Trim() + "'" + ",test_item='" + ja[0]["test_item"].ToString().Trim() + "'" + ",packing='" + ja[0]["packing"].ToString().Trim() + "'"
                         + ",amusr='******'" + ",amtim='" + sytim + "'"
                         + " Where id='" + id + "'";
            }
            result = sh.ExecuteSqlUpdate(strSql);

            if (result == "")
            {
                msg = "記錄更新成功!";
            }
            else
            {
                msg = result; //"更新失敗,制單編號: "+mo_id+" !";
            }
            return(msg);
        }
コード例 #5
0
ファイル: Ax_Oc_Polo.ashx.cs プロジェクト: cfmis/cfw
        private void UpdateOC1(HttpContext context)
        {
            clsPublic cls = new clsPublic();
            string    ReturnValue = string.Empty;
            string    remote_db = DBUtility.remote_db;
            string    within_code = DBUtility.within_code;
            BasePage  bp = new BasePage();
            string    userId = bp.getUserName();
            string    para = context.Request["param"];
            string    mo_id = "";
            string    regions = "";
            string    req_mock_up = "", rec_mock_up = "";
            string    data_sheet_pre = "", data_sheet_sent = "";
            string    result = "";

            if (para != null)
            {
                JArray ja = (JArray)JsonConvert.DeserializeObject(para);
                mo_id           = ja[0]["mo_id"].ToString().Trim();
                regions         = ja[0]["regions"] != null ? ja[0]["regions"].ToString().Trim() : "";
                req_mock_up     = ja[0]["req_mock_up"] != null ? ja[0]["req_mock_up"].ToString().Trim() : "";
                rec_mock_up     = ja[0]["rec_mock_up"] != null ? ja[0]["rec_mock_up"].ToString().Trim() : "";
                data_sheet_pre  = ja[0]["data_sheet_pre"] != null ? ja[0]["data_sheet_pre"].ToString().Trim() : "";
                data_sheet_sent = ja[0]["data_sheet_sent"] != null ? ja[0]["data_sheet_sent"].ToString().Trim() : "";
            }
            string strSql      = "";
            string create_time = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

            strSql += string.Format(@" SET XACT_ABORT  ON ");
            strSql += string.Format(@" BEGIN TRANSACTION ");
            if (!FindMo(mo_id))
            {
                strSql += string.Format(@"Insert Into so_polo_order_trace (mo_id,regions,req_mock_up,rec_mock_up,data_sheet_pre,data_sheet_sent,create_user,create_time) Values " +
                                        "('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')"
                                        , mo_id, regions, req_mock_up, rec_mock_up, data_sheet_pre, data_sheet_sent, userId, create_time);
            }
            else
            {
                strSql += string.Format(@"Update so_polo_order_trace Set regions='{0}',req_mock_up='{1}',rec_mock_up='{2}',data_sheet_pre='{3}'" +
                                        ",data_sheet_sent='{4}',update_user='******',update_time='{6}'" +
                                        " Where mo_id='{7}'"
                                        , regions, req_mock_up, rec_mock_up, data_sheet_pre, data_sheet_sent, userId, create_time, mo_id);
            }
            strSql += string.Format(@" COMMIT TRANSACTION ");
            result  = sh.ExecuteSqlUpdate(strSql);
            if (result == "")
            {
                ReturnValue = "更新記錄成功!";
            }
            else
            {
                ReturnValue = "更新記錄失敗!";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(ReturnValue);
            context.Response.End();
        }
コード例 #6
0
ファイル: Ax_FuncManager.ashx.cs プロジェクト: cfmis/cfw
        private void UpdateData(HttpContext context, string edit_mode)
        {
            string para        = context.Request["param"];
            string result      = "";
            int    authorityid = 0;
            JArray ja          = (JArray)JsonConvert.DeserializeObject(para);

            authorityid = ja[0]["authorityid"].ToString() != "" ? Convert.ToInt32(ja[0]["authorityid"].ToString()) : 0;
            string strSql = "";

            if (edit_mode == "2")//刪除
            {
                strSql = " Delete From t_Authority Where authorityid='" + authorityid + "'";
            }
            else
            {
                string authorityname = "", orderseq = "00";
                string moduleurl = "", weburl = "", classa = "";
                int    typeid = 0;
                authorityname = ja[0]["authorityname"].ToString().Trim();
                typeid        = ja[0]["typeid"].ToString() != "" ? Convert.ToInt32(ja[0]["typeid"].ToString()) : 0;
                moduleurl     = ja[0]["moduleurl"].ToString().Trim();
                weburl        = ja[0]["weburl"].ToString().Trim();
                orderseq      = ja[0]["orderseq"].ToString().Trim() != "" ? ja[0]["orderseq"].ToString().Trim() : "00";
                classa        = ja[0]["class"].ToString().Trim() != "" ? ja[0]["class"].ToString().Trim() : "";
                strSql        = "Select authorityid From t_Authority Where authorityid='" + authorityid + "'";
                DataTable dt = SQLHelper.ExecuteSqlReturnDataTable(strSql);
                if (dt.Rows.Count == 0)
                {
                    strSql = "Insert Into t_Authority (authorityid,authorityname,typeid,moduleurl,weburl,orderseq,class)" +
                             " Values ('"
                             + authorityid + "','" + authorityname + "','" + typeid + "','" + moduleurl + "','" + weburl
                             + "','" + orderseq + "','" + classa + "')";
                }
                else
                {
                    strSql = "Update t_Authority Set authorityname='" + authorityname + "',typeid='" + typeid + "',moduleurl='" + moduleurl
                             + "',weburl='" + weburl + "',orderseq='" + orderseq + "',class='" + classa + "'"
                             + " Where authorityid='" + authorityid + "'";
                }
            }

            result = sh.ExecuteSqlUpdate(strSql);
            if (result == "")
            {
                result = "OK";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
            context.Response.End();
        }
コード例 #7
0
ファイル: Sa_MoMoveStatus_Set.aspx.cs プロジェクト: cfmis/cfw
        protected void DeleteMo(string id)
        {
            string strSql     = "";
            string result     = "";
            string count_date = txtDate.Text;

            strSql = "Delete From mo_movestatus Where id='" + id + "'";

            result = sh.ExecuteSqlUpdate(strSql);
            if (result != "")
            {
                StrHlp.WebMessageBox(this.Page, result);
            }
        }
コード例 #8
0
ファイル: Ax_Bs_Mat_Rate.ashx.cs プロジェクト: cfmis/cfw
        protected void updateProcess(HttpContext context)
        {
            BasePage bp           = new BasePage();
            string   para         = context.Request["param"];
            JArray   ja           = (JArray)JsonConvert.DeserializeObject(para);
            string   result       = "";
            string   Prd_item     = ja[0]["Prd_item"].ToString().Trim();
            string   Dep_id       = ja[0]["Dep_id"].ToString().Trim();
            string   Mat_item     = ja[0]["Mat_item"].ToString().Trim();
            decimal  Prd_weg      = ja[0]["Prd_weg"].ToString().Trim() != "" ? Convert.ToDecimal(ja[0]["Prd_weg"].ToString().Trim()) : 0;
            decimal  Waste_weg    = ja[0]["Waste_weg"].ToString().Trim() != "" ? Convert.ToDecimal(ja[0]["Waste_weg"].ToString().Trim()) : 0;
            decimal  Use_weg      = ja[0]["Use_weg"].ToString().Trim() != "" ? Convert.ToDecimal(ja[0]["Use_weg"].ToString().Trim()) : 0;
            decimal  Hour_std_qty = ja[0]["Hour_std_qty"].ToString().Trim() != "" ? Convert.ToDecimal(ja[0]["Hour_std_qty"].ToString().Trim()) : 0;
            decimal  Kg_qty_rate  = ja[0]["Kg_qty_rate"].ToString().Trim() != "" ? Convert.ToDecimal(ja[0]["Kg_qty_rate"].ToString().Trim()) : 0;
            string   crusr        = bp.getUserName();
            string   crtim        = System.DateTime.Now.ToString("yyyy/MM/dd HH:ss:mm");
            string   strSql       = "";

            strSql += string.Format(@" SET XACT_ABORT  ON ");
            strSql += string.Format(@" BEGIN TRANSACTION ");
            DataTable dtPrdItem = CehckPrdItem(Prd_item, Mat_item, Dep_id);

            if (dtPrdItem.Rows.Count == 0)
            {
                strSql += string.Format(@"Insert Into bs_mat_rate (Prd_item,Mat_item,Dep_id,Prd_weg,Waste_weg,Use_weg,Hour_std_qty,Kg_qty_rate,crusr,crtim) Values " +
                                        "('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')"
                                        , Prd_item, Mat_item, Dep_id, Prd_weg, Waste_weg, Use_weg, Hour_std_qty, Kg_qty_rate, crusr, crtim);
            }
            else
            {
                strSql += string.Format(@"Update bs_mat_rate Set Prd_weg='{0}',Waste_weg='{1}',Use_weg='{2}',Hour_std_qty='{3}'" +
                                        ",Kg_qty_rate='{4}',crusr='******',crtim='{6}'" +
                                        " Where Prd_item='{7}' And Mat_item='{8}' And Dep_id='{9}'"
                                        , Prd_weg, Waste_weg, Use_weg, Hour_std_qty, Kg_qty_rate, crusr, crtim, Prd_item, Mat_item, Dep_id);
            }
            //strSql += string.Format(@" IF @@error <> 0 ");
            //strSql += string.Format(@" ROLLBACK TRANSACTION ");
            //strSql += string.Format(@" ELSE ");
            strSql += string.Format(@" COMMIT TRANSACTION ");

            result = sh.ExecuteSqlUpdate(strSql);
            if (result == "")
            {
                result = "記錄更新成功!";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
            context.Response.End();
        }
コード例 #9
0
ファイル: SaOrderTestTraceDAL.cs プロジェクト: cfmis/cfw
        public string updOrderTestInvoice(string invoice_id, string invoice_date, string report_no, string amount, string curr
                                          , string ref_report, string mo_id, string custcode, string brand)
        {
            string  result = "";
            SQLHelp sh     = new SQLHelp();
            string  strSql = "";

            if (findOorderInvoice(invoice_id) == 0)
            {
                strSql = "Insert Into so_ordertest_invoice (invoice_id,invoice_date,report_no,amount,curr,ref_report,mo_id,custcode,brand)" +
                         " Values ("
                         + "'" + invoice_id + "','" + invoice_date + "','" + report_no + "','" + amount + "','" + curr + "','" + ref_report + "','"
                         + mo_id + "','" + custcode + "','" + brand + "'"
                         + ")";
            }
            else
            {
                strSql = "Update so_ordertest_invoice Set " +
                         "invoice_date='" + invoice_date + "'" + ",report_no='" + report_no + "'" + ",amount='" + amount + "'"
                         + ",curr='" + curr + "'" + ",ref_report='" + ref_report + "'" + ",mo_id='" + mo_id + "'" + ",custcode='" + custcode + "'"
                         + ",brand='" + brand + "'"
                         + " Where invoice_id='" + invoice_id + "'";
            }
            result = sh.ExecuteSqlUpdate(strSql);
            return(result);
        }
コード例 #10
0
ファイル: Ax_GoodsTransferJx.ashx.cs プロジェクト: cfmis/cfw
        public void SetCplFlag(HttpContext context)
        {
            SQLHelp sh       = new SQLHelp();
            string  Prd_dep  = context.Request["prd_dep"].ToString();
            string  Prd_mo   = context.Request["prd_mo"].ToString();
            string  Prd_item = context.Request["prd_item"].ToString();
            string  Cpl_flag = context.Request["cpl_flag"].ToString();

            if (Cpl_flag == "1")
            {
                Cpl_flag = "";
            }
            else
            {
                Cpl_flag = "1";
            }
            string strSql = "Update dgcf_pad.dbo.product_transfer_jx_summary Set Cpl_flag='" + Cpl_flag + "'" +
                            " Where Prd_dep='" + Prd_dep + "' And Prd_mo='" + Prd_mo + "' And Prd_item='" + Prd_item + "'";
            string result = sh.ExecuteSqlUpdate(strSql);

            if (result == "")
            {
                result = "記錄更新成功!";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
            context.Response.End();
        }
コード例 #11
0
ファイル: SalesQueryPublicDAL.cs プロジェクト: cfmis/cfw
        public string updOrderTrace(string within_code, string mo_id, string prd_status
                                    , string ret_hk_status, string sample_hk_status, string chk_color_status, string chk_color_oth, string chk_color_date, string job_no
                                    , string test_result, string test_status, string inv_no, string inv_date, string shipment, string shipment_oth, string awb_no, string sent_date
                                    , string remark, string mo_status)
        {
            string  result = "";
            SQLHelp sh     = new SQLHelp();
            string  strSql = "";

            if (findOorderTrace(within_code, mo_id) == 0)
            {
                strSql = "Insert Into so_order_trace (within_code,mo_id, prd_status,ret_hk_status, sample_hk_status, chk_color_status, chk_color_oth" +
                         ", chk_color_date, job_no,test_result, test_status, inv_no,inv_date, shipment,shipment_oth, awb_no, sent_date, remark, mo_status)" +
                         " Values ("
                         + "'" + within_code + "'" + "," + "'" + mo_id + "'" + "," + "'" + prd_status + "'" + "," + "'" + ret_hk_status + "'" + "," + "'" + sample_hk_status + "'"
                         + "," + "'" + chk_color_status + "'" + "," + "'" + chk_color_oth + "'" + "," + "'" + chk_color_date + "'" + "," + "'" + job_no + "'"
                         + "," + "'" + test_result + "'" + "," + "'" + test_status + "'" + "," + "'" + inv_no + "'" + "," + "'" + inv_date + "'" + "," + "'" + shipment + "'" + "," + "'" + shipment_oth + "'"
                         + "," + "'" + awb_no + "'" + "," + "'" + sent_date + "'" + "," + "'" + remark + "'" + "," + "'" + mo_status + "'"
                         + ")";
            }
            else
            {
                strSql = "Update so_order_trace Set "
                         + "prd_status=" + "'" + prd_status + "'" + ",ret_hk_status=" + "'" + ret_hk_status + "'" + ",sample_hk_status=" + "'" + sample_hk_status + "'"
                         + ",chk_color_status=" + "'" + chk_color_status + "'" + ",chk_color_oth=" + "'" + chk_color_oth + "'" + ",chk_color_date=" + "'"
                         + chk_color_date + "'" + ",job_no=" + "'" + job_no + "'" + ",test_result=" + "'" + test_result + "'" + ",test_status=" + "'" + test_status + "'"
                         + ",inv_no=" + "'" + inv_no + "'" + ",inv_date=" + "'" + inv_date + "'"
                         + ",shipment=" + "'" + shipment + "'" + ",shipment_oth=" + "'" + shipment_oth + "'"
                         + ",awb_no=" + "'" + awb_no + "'" + ",sent_date=" + "'" + sent_date + "'" + ",remark=" + "'" + remark + "'" + ",mo_status=" + "'" + mo_status + "'"
                         + " Where within_code='" + within_code + "' And mo_id='" + mo_id + "'";
            }
            result = sh.ExecuteSqlUpdate(strSql);
            return(result);
        }
コード例 #12
0
        protected void DeleteMo(int id)
        {
            string strSql = "";
            string result = "";

            strSql = "Delete From mo_periodover5day_no Where id>=0";
            if (id > 0)
            {
                strSql += " AND id='" + id + "'";
            }
            result = sh.ExecuteSqlUpdate(strSql);
            if (result != "")
            {
                StrHlp.WebMessageBox(this.Page, result);
            }
            LoadBatchMo();
        }
コード例 #13
0
ファイル: SaOrderTestTraceDAL.cs プロジェクト: cfmis/cfw
        public string deleteTestInvoice(string invoice_id)
        {
            string  result = "";
            SQLHelp sh     = new SQLHelp();
            string  strSql = "";

            strSql = "Delete From so_ordertest_invoice Where invoice_id='" + invoice_id + "'";
            result = sh.ExecuteSqlUpdate(strSql);
            return(result);
        }
コード例 #14
0
ファイル: Ax_UserGroupManager.ashx.cs プロジェクト: cfmis/cfw
        private void UpdateData(HttpContext context, string edit_mode)
        {
            string para    = context.Request["param"];
            int    groupid = 0;
            JArray ja      = (JArray)JsonConvert.DeserializeObject(para);

            groupid = Convert.ToInt32(ja[0]["groupid"].ToString());
            string strSql = "";

            if (edit_mode == "2")
            {
                strSql = " Delete From t_group Where groupid='" + groupid + "'";
            }
            else
            {
                string groupname = "";
                string cdesc     = "";
                groupname = ja[0]["groupname"].ToString().Trim();
                cdesc     = ja[0]["cdesc"].ToString().Trim();
                strSql    = "Select groupid From t_group Where groupid=' " + groupid + "'";
                DataTable dt = SQLHelper.ExecuteSqlReturnDataTable(strSql);
                if (dt.Rows.Count == 0)
                {
                    strSql = "Insert Into t_group (groupid,groupname,Description,rst) Values ('" + groupid + "','" + groupname + "','" + cdesc + "','" + "1" + "')";
                }
                else
                {
                    strSql = "Update t_group Set groupname='" + groupname + "',Description='" + cdesc + "'" + " Where groupid='" + groupid + "'";
                }
            }

            string result = sh.ExecuteSqlUpdate(strSql);

            if (result == "")
            {
                result = "OK";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
            context.Response.End();
        }
コード例 #15
0
ファイル: SaOrderTestTraceDAL.cs プロジェクト: cfmis/cfw
        public string updOrderTestTrace(string mo_id, string mo_group, string rt_from_date, string ref_no, string lab_house, string mat_desc
                                        , string cust_item, string cust_size, string cust_color, string season, string division, string test_method
                                        , string bulk_mo, string sent_to_hk, string pass_to_lab, string test_results, string rsl, string rsl_rp_date
                                        , string appearance, string appearance_rp_date, string resist, string resist_rp_date, string salvia, string salvia_rp_date
                                        , string snap, string snap_rp_date, string underpart, string underpart_rp_date, string ftc_cmmts)
        {
            string  result = "";
            SQLHelp sh     = new SQLHelp();
            string  strSql = "";

            if (findOorderTrace(mo_id) == 0)
            {
                strSql = "Insert Into so_ordertest_trace (mo_id,mo_group,rt_from_date, ref_no,lab_house,mat_desc,cust_item,cust_size,cust_color,season,division,test_method" +
                         ",bulk_mo,sent_to_hk,pass_to_lab,test_results,rsl,rsl_rp_date,appearance,appearance_rp_date,resist,resist_rp_date,salvia,salvia_rp_date" +
                         ",snap,snap_rp_date,underpart,underpart_rp_date,ftc_cmmts)" +
                         " Values ("
                         + "'" + mo_id + "','" + mo_group + "','" + rt_from_date + "','" + ref_no + "','" + lab_house + "','" + mat_desc
                         + "','" + cust_item + "','" + cust_size + "','" + cust_color + "','" + season
                         + "','" + division + "','" + test_method + "','" + bulk_mo + "','" + sent_to_hk
                         + "','" + pass_to_lab + "','" + test_results + "','" + rsl + "','" + rsl_rp_date
                         + "','" + appearance + "','" + appearance_rp_date + "','" + resist + "','" + resist_rp_date
                         + "','" + salvia + "','" + salvia_rp_date + "','" + snap + "','" + snap_rp_date
                         + "','" + underpart + "','" + underpart_rp_date + "','" + ftc_cmmts + "'"
                         + ")";
            }
            else
            {
                strSql = "Update so_ordertest_trace Set "
                         + "mo_group='" + mo_group + "'" + ",rt_from_date='" + rt_from_date + "'" + ",ref_no='" + ref_no + "'" + ",lab_house='" + lab_house + "'"
                         + ",mat_desc='" + mat_desc + "'" + ",cust_item='" + cust_item + "'" + ",cust_size='" + cust_size + "'"
                         + ",cust_color='" + cust_color + "'" + ",season='" + season + "'" + ",division='" + division + "'"
                         + ",test_method='" + test_method + "'" + ",bulk_mo='" + bulk_mo + "'" + ",sent_to_hk='" + sent_to_hk + "'"
                         + ",pass_to_lab='" + pass_to_lab + "'" + ",test_results='" + test_results + "'" + ",rsl='" + rsl + "'"
                         + ",rsl_rp_date='" + rsl_rp_date + "'" + ",appearance='" + appearance + "'" + ",appearance_rp_date='" + appearance_rp_date + "'"
                         + ",resist='" + resist + "'" + ",resist_rp_date='" + resist_rp_date + "'" + ",salvia='" + salvia + "'"
                         + ",salvia_rp_date='" + salvia_rp_date + "'" + ",snap='" + snap + "'" + ",snap_rp_date='" + snap_rp_date + "'"
                         + ",underpart='" + underpart + "'" + ",underpart_rp_date='" + underpart_rp_date + "'" + ",ftc_cmmts='" + ftc_cmmts + "'"
                         + " Where mo_id='" + mo_id + "'";
            }
            result = sh.ExecuteSqlUpdate(strSql);
            return(result);
        }
コード例 #16
0
        private void Query(HttpContext context)
        {
            string tb_type    = context.Request["tb_type"];
            string arrange_id = "";
            //string prd_dep = context.Request["prd_dep"];
            //string prd_mo = context.Request["prd_mo"];
            //string prd_item = context.Request["prd_item"];
            //string now_date = context.Request["now_date"];
            string upd_type = "0";
            //if(prd_dep==null)
            //{
            HttpRequest request = System.Web.HttpContext.Current.Request;

            Uri    Project_Id = request.UrlReferrer;
            string a1         = Project_Id.Query.ToString();

            string[] urlPara = getUrlPara(a1);
            //prd_dep = urlPara[0];
            //prd_mo = urlPara[1];
            //prd_item = urlPara[2];
            //now_date = urlPara[3];
            arrange_id = urlPara[2];
            //}
            bool is_val = false;
            //SQLHelp sh = new SQLHelp();
            string strSql    = "";
            string msg       = "";
            string tablename = "";

            if (tb_type == "hrm01")
            {
                //strSql = "Select a.hrm1wid,a.hrm1name,c.hrc5name,b.hrc4name" +
                //    " From dgsql1.dghr.dbo.hrm01 a" +
                //    " Inner Join dgsql1.dghr.dbo.hrc04 b On a.hrm1stat2=b.hrc4class" +
                //    " Left Join dgsql1.dghr.dbo.hrc05 c On a.hrm1job=c.hrc5job" +
                //    " Where a.hrm1state='1'";
                //if (prd_dep != "" && prd_dep != null)
                //{
                //    strSql += " And b.wip_dep='" + prd_dep + "'";
                //    is_val = true;
                //}

                //if (is_val == false)
                //    strSql += " And a.hrm1stat2=''";
                //strSql += " Order By a.hrm1job,a.hrm1wid";
                //tablename = "hrm01";
            }
            else
            {
                if (tb_type == "prd01")
                {
                    strSql = "Select b.worker_id,c.hrm1name,b.work_type_id,d.work_type_desc" +
                             " From dgcf_pad.dbo.product_arrange a" +
                             " Inner Join dgcf_pad.dbo.product_arrange_worker b On a.arrange_id=b.arrange_id" +
                             " Left Join dgsql1.dghr.dbo.hrm01 c On b.worker_id COLLATE chinese_taiwan_stroke_CI_AS=c.hrm1wid" +
                             " Left Join dgcf_pad.dbo.work_type d On b.work_type_id=d.work_type_id " +
                             " Where a.arrange_id='" + arrange_id + "'";

                    tablename = "prd01";
                }
                else
                {
                    upd_type = "1";
                    string worker_id    = context.Request["worker_id"];
                    string work_type_id = context.Request["work_type_id"].Trim();
                    if (tb_type == "upd_prd01")
                    {
                        BasePage bp      = new BasePage();
                        string   user_id = "admin";// bp.getUserName();
                        string   crtim   = System.DateTime.Now.ToString("yyyy/MM/dd HH:SS");
                        worker_id = worker_id.Trim().PadLeft(10, '0');
                        if (chkWorker(arrange_id, worker_id, work_type_id) == 0)
                        {
                            strSql = "Insert Into dgcf_pad.dbo.product_arrange_worker (arrange_id,worker_id,work_type_id,crusr)" +
                                     " Values (" + "'" + arrange_id + "','" + worker_id + "','" + work_type_id + "','" + user_id + "')";// + "','" + crtim,crtim
                        }
                        string result = sh.ExecuteSqlUpdate(strSql);
                        if (result == "")
                        {
                            msg = "添加工號成功!";
                        }
                        else
                        {
                            msg = "添加工號失敗!";
                        }
                    }
                    else
                    {
                        if (tb_type == "delete_prd01")
                        {
                            strSql = "Delete From dgcf_pad.dbo.product_arrange_worker Where arrange_id='" + arrange_id + "' And worker_id='" + worker_id + "' And work_type_id='" + work_type_id + "'";
                            string result = sh.ExecuteSqlUpdate(strSql);
                            if (result == "")
                            {
                                msg = "刪除工號成功!";
                            }
                            else
                            {
                                msg = "刪除工號失敗!";
                            }
                        }
                    }
                }
            }
            if (upd_type == "0")
            {
                DataSet   ds = sh.ExecuteSqlReturnDataSet(strSql, tablename);
                DataTable dt = ds.Tables[0];

                int count = dt.Rows.Count;
                //DataTable dt = sh.ExecuteSqlReturnDataTable(strSql);
                string strJson = Dataset2Json(ds, count); //DataSet数据转化为Json数据
                                                          //string strJson = DataTableJson(dt);//DataSet数据转化为Json数据
                context.Response.Write(strJson);
            }
            else
            {
                context.Response.Write(msg);
            }
            context.Response.End();
        }
コード例 #17
0
        protected void UpdateProcessNew(HttpContext context)
        {
            BasePage  bp            = new BasePage();
            string    para          = context.Request["param"];
            JArray    ja            = (JArray)JsonConvert.DeserializeObject(para);
            string    result        = "";
            string    Flag_id       = ja[0]["Flag_id"].ToString().Trim();
            string    Transfer_date = ja[0]["Transfer_date"].ToString().Trim();
            string    Prd_mo        = ja[0]["Prd_mo"].ToString().Trim();
            string    Prd_item      = ja[0]["Prd_item"].ToString().Trim();
            string    Lot_no        = ja[0]["Lot_no"].ToString().Trim();
            string    Loc_no        = ja[0]["Loc_no"].ToString().Trim();
            string    Wip_id        = ja[0]["Wip_id"].ToString().Trim();
            decimal   Qty           = ja[0]["Qty"].ToString().Trim() != "" ? Convert.ToDecimal(ja[0]["Qty"].ToString().Trim()) : 0;
            decimal   Weg           = ja[0]["Weg"].ToString().Trim() != "" ? Convert.ToDecimal(ja[0]["Weg"].ToString().Trim()) : 0;
            string    Use_item      = ja[0]["Use_item"].ToString().Trim();
            string    RequestNo     = ja[0]["RequestNo"].ToString().Trim();
            string    crusr         = bp.getUserName();
            string    crtim         = System.DateTime.Now.ToString("yyyy/MM/dd HH:ss:mm");
            DataTable dtFlag        = GetFlag(Flag_id);
            string    flag1         = dtFlag.Rows[0]["flag1"].ToString().Trim();
            string    flag2         = dtFlag.Rows[0]["flag2"].ToString().Trim();

            bool valid_flag = true;

            result = chkDataValid(Loc_no, Prd_item, Prd_mo, Lot_no, flag1, Weg, Qty);
            if (result != "")
            {
                valid_flag = false;
            }
            else
            {
                if (flag2 == "TO")
                {
                    result = chkDataValid(Wip_id, Prd_item, Prd_mo, Lot_no, "+", Weg, Qty);
                    if (result != "")
                    {
                        valid_flag = false;
                    }
                }
            }
            if (Flag_id == "01" && RequestNo != "")
            {
                result = chkRequestNoValid(RequestNo);
                if (result != "")
                {
                    valid_flag = false;
                }
            }
            if (valid_flag == true)
            {
                string strSql = "";
                string id     = GenID(Loc_no, Flag_id, Transfer_date);
                strSql += string.Format(@" SET XACT_ABORT  ON ");
                strSql += string.Format(@" BEGIN TRANSACTION ");
                strSql += string.Format(@"Insert Into st_jx_store_transfer (id,flag_id,transfer_date,Loc_no,prd_item,prd_mo,lot_no,wip_id,use_item,transfer_qty,transfer_weg,request_no,crusr,crtim) Values " +
                                        "('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}')"
                                        , id, Flag_id, Transfer_date, Loc_no, Prd_item, Prd_mo, Lot_no, Wip_id, Use_item, Qty, Weg, RequestNo, crusr, crtim);
                strSql += string.Format(joinUpdateStr(Loc_no, Prd_item, Prd_mo, Lot_no, flag1, Weg, Qty, crusr, crtim));
                if (flag2 == "TO")
                {
                    strSql += string.Format(joinUpdateStr(Wip_id, Prd_item, Prd_mo, Lot_no, "+", Weg, Qty, crusr, crtim));
                }
                if (Flag_id == "01" && RequestNo != "")//如果是From DG收貨,則更新申請單的收貨數量
                {
                    strSql += string.Format(joinUpdateRequestStr("+", RequestNo, Weg, Qty, crusr, crtim));
                }

                strSql += string.Format(@" COMMIT TRANSACTION ");

                result = sh.ExecuteSqlUpdate(strSql);
            }
            if (result == "")
            {
                result = "記錄更新成功!";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
            context.Response.End();
        }
コード例 #18
0
ファイル: Ax_UserCreate.ashx.cs プロジェクト: cfmis/cfw
        private void UpdateData(HttpContext context, string edit_mode)
        {
            string para   = context.Request["param"];
            string result = "";
            string uname  = "";
            JArray ja     = (JArray)JsonConvert.DeserializeObject(para);

            uname = ja[0]["uname"].ToString();
            string strSql = "", strSql_geo = "";

            if (edit_mode == "2")//刪除
            {
                strSql = " Delete From tb_sy_user Where uname='" + uname + "'";
            }
            else
            {
                string uname_desc = "", pwd = "", language = "0", vend_id = "", u_type = "I";
                string sales_group = "", user_group = "", state = "0";
                int    t_groupid = 0, rid = 0, t_typeid = 0, t_subclassid = 1;
                string geo_groupid = "";
                string userid      = bp.getUserName();
                uname_desc  = ja[0]["uname_desc"].ToString().Trim();
                t_groupid   = ja[0]["t_groupid"].ToString() != "" ? Convert.ToInt32(ja[0]["t_groupid"].ToString()) : 0;
                sales_group = ja[0]["sales_group"].ToString().Trim();
                user_group  = ja[0]["user_group"].ToString().Trim();
                language    = ja[0]["language"].ToString().Trim() != "" ? ja[0]["language"].ToString().Trim() : "0";
                u_type      = ja[0]["u_type"].ToString().Trim() != "" ? ja[0]["u_type"].ToString().Trim() : "I";
                state       = ja[0]["state"].ToString().Trim() != "" ? ja[0]["state"].ToString().Trim() : "0";
                vend_id     = ja[0]["vend_id"].ToString().Trim();
                rid         = ja[0]["rid"].ToString() != "" ? Convert.ToInt32(ja[0]["rid"].ToString()) : 0;
                geo_groupid = ja[0]["geo_groupid"].ToString().Trim() != "" ? ja[0]["geo_groupid"].ToString().Trim() : "0";
                strSql      = "Select uname From tb_sy_user Where uname='" + uname + "'";
                DataTable dt = SQLHelper.ExecuteSqlReturnDataTable(strSql);
                if (dt.Rows.Count == 0)
                {
                    strSql = "Insert Into tb_sy_user (uname,uname_desc,pwd,rid,language,vend_id,rid_oa,u_type,sales_group" +
                             ",user_group,t_typeid,t_subclassid,t_groupid,state)" +
                             " Values ('"
                             + uname + "','" + uname_desc + "','" + pwd + "','" + rid + "','" + language + "','" + vend_id + "','" + t_groupid + "','" + u_type + "','" + sales_group
                             + "','" + user_group + "','" + t_typeid + "','" + t_subclassid + "','" + t_groupid + "','" + state + "')";
                }
                else
                {
                    strSql = "Update tb_sy_user Set uname_desc='" + uname_desc + "',rid='" + rid + "',language='" + language
                             + "',u_type='" + u_type + "',sales_group='" + sales_group + "',user_group='" + user_group + "',t_typeid='" + t_typeid + "',t_subclassid='" + t_subclassid
                             + "',t_groupid='" + t_groupid + "',state='" + state
                             + "'" + " Where uname='" + uname + "'";
                }
                //更新Geo中的用戶表
                strSql_geo = "Select user_id From " + remote_db + "sys_user Where user_id='" + uname + "'";
                dt         = SQLHelper.ExecuteSqlReturnDataTable(strSql_geo);
                if (dt.Rows.Count == 0)
                {
                    PublicAppDAL pba = new PublicAppDAL();
                    pwd        = pba.GeoEncrypt(ja[0]["pwd"].ToString().Trim());
                    strSql_geo = "Insert Into " + remote_db + "sys_user" +
                                 " (within_code,user_id,user_name,password,group_id,ava_date,status,typeid,masterdepid,usr_type,inherit_type,createby,createdate)" +
                                 " Values ('"
                                 + "" + "','" + uname + "','" + uname_desc + "','" + pwd + "','" + geo_groupid + "','" + System.DateTime.Now.ToString("yyyy/MM/dd")
                                 + "','" + "0" + "','" + "U" + "','" + "Y" + "','" + "G" + "','" + "Y" + "','" + userid + "','" + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
                                 + "')";
                }
                else//如果存在,就不更新Geo中的用戶了
                {
                    strSql_geo = "";
                }
                //    strSql_geo = "Update " + remote_db + "sys_user Set "
                //        + "user_name='" + uname_desc + "',group_id='" + geo_groupid + "',modifyby='" + userid + "',modifydate='" + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
                //        + "'";
            }

            result = sh.ExecuteSqlUpdate(strSql);
            if (result == "" && strSql_geo != "")//更新Geo中的用戶表
            {
                result = sh.ExecuteSqlUpdate(strSql_geo);
            }
            if (result == "")
            {
                result = "OK";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
            context.Response.End();
        }
コード例 #19
0
        /// <summary>
        /// 数据集操作
        /// </summary>
        /// <param name="ds"></param>
        /// 更新Excel表到临时表pu_temp_excel中
        private void DataSetOperator(DataTable dt, string fileName)
        {
            string result = "";
            string arrange_date, prd_dep = "";
            int    excel_row = 0;

            prd_dep      = dlDep.SelectedValue.ToString().Trim();
            arrange_date = txtArrangeDate.Value.ToString(); //System.DateTime.Now.ToString("yyyy/MM/dd");
            string arrange_seq, prd_mo, prd_item, prd_seq, receive_date, prd_worker, delivery_date, mat_item
            , plan_date, pre_date, remark, mat_status, outside, wash_oil, wp_id, arrange_machine;
            int    arrange_qty, cpl_qty, not_cpl_qty;
            string strSql = "";

            user_id = getUserName();
            string now_date = arrange_date;// System.DateTime.Now.ToString("yyyy/MM/dd");

            try
            {
                string prd_dep_h = "", prd_seq_h = "", receive_date_h = "", prd_mo_h = "", arrange_machine_h = "", prd_item_h = "", prd_worker_h = "", delivery_date_h = ""
                , arrange_qty_h = "", cpl_qty_h = "", not_cpl_qty_h = "", mat_item_h = ""
                , plan_date_h = "", pre_date_h = "", remark_h = "", mat_status_h = "", outside_h = "", wash_oil_h = ""
                , wp_id_h = "";
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    string colName = dt.Columns[j].ColumnName;
                    prd_dep_h         = (colName == "部門編號" ? colName : prd_dep_h);
                    prd_seq_h         = (colName == "序號" ? colName : prd_seq_h);
                    receive_date_h    = (colName == "JX接單日期" ? colName : receive_date_h);
                    prd_item_h        = (colName == "產品編號" ? colName : prd_item_h);
                    prd_mo_h          = (colName == "訂單編號/頁數" || colName == "訂單編號" || colName == "制單編號" || colName == "頁數" ? colName : prd_mo_h);
                    arrange_machine_h = (colName == "機台編號" || colName == "機器編號" || colName == "機器編碼" ? colName : arrange_machine_h);
                    prd_worker_h      = (colName == "操作員" || colName == "工號" ? colName : prd_worker_h);
                    delivery_date_h   = (colName == "訂單交貨期" ? colName : delivery_date_h);
                    arrange_qty_h     = (colName == "訂單生產數量" ? colName : arrange_qty_h);
                    cpl_qty_h         = (colName == "已生產數量" ? colName : cpl_qty_h);
                    not_cpl_qty_h     = (colName == "未生產生數量" || colName == "未生產數量" ? colName : not_cpl_qty_h);
                    mat_item_h        = (colName == "原料曲" || colName == "原料編號" ? colName : mat_item_h);
                    plan_date_h       = (colName == "計劃生產日期" ? colName : plan_date_h);
                    pre_date_h        = (colName == "預計完成日期" ? colName : pre_date_h);
                    remark_h          = (colName == "備註" ? colName : remark_h);
                    mat_status_h      = (colName == "生產原料狀態" ? colName : mat_status_h);
                    outside_h         = (colName == "外發大通電鍍編碼(CL-T0011)" ? colName : outside_h);
                    wash_oil_h        = (colName == "洗油" ? colName : wash_oil_h);
                    wp_id_h           = (colName == "車間" || colName == "生產車間" || colName == "車間編號" ? colName : wp_id_h);
                }

                strSql += string.Format(@" BEGIN TRANSACTION ");
                ////strSql = "";
                strSql += string.Format(@" Delete From product_arrange_jx Where now_date='{0}'", now_date);
                ////result = sh.ExecuteSqlUpdate(strSql);//更新明細記錄
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //strSql = "";
                    excel_row = excel_row + 2;
                    DataRow dr = dt.Rows[i];
                    prd_mo   = (prd_mo_h == "" ? "" : dr[prd_mo_h].ToString().Trim());
                    prd_item = (prd_item_h == "" ? "" : dr[prd_item_h].ToString().Trim());
                    if (prd_mo == "YBY013687")
                    {
                        prd_mo = "YBY013687";
                    }
                    if (prd_mo != "" && prd_item != "")
                    {
                        prd_dep         = (prd_dep_h == "" ? "" : dr[prd_dep_h].ToString().Trim().ToUpper());
                        prd_seq         = (prd_seq_h == "" ? "" : dr[prd_seq_h].ToString().Trim());
                        receive_date    = (receive_date_h == "" ? "" : dr[receive_date_h].ToString().Trim());
                        prd_worker      = (prd_worker_h == "" ? "" : dr[prd_worker_h].ToString().Trim());
                        delivery_date   = (delivery_date_h == "" ? "" : dr[delivery_date_h].ToString().Trim());
                        mat_item        = (mat_item_h == "" ? "" : dr[mat_item_h].ToString().Trim());
                        plan_date       = (plan_date_h == "" ? "" : dr[plan_date_h].ToString().Trim());
                        pre_date        = (pre_date_h == "" ? "" : dr[pre_date_h].ToString().Trim());
                        remark          = (remark_h == "" ? "" : dr[remark_h].ToString().Trim());
                        mat_status      = (mat_status_h == "" ? "" : dr[mat_status_h].ToString().Trim());
                        outside         = (outside_h == "" ? "" : dr[outside_h].ToString().Trim());
                        wash_oil        = (wash_oil_h == "" ? "" : dr[wash_oil_h].ToString().Trim());
                        arrange_qty     = (arrange_qty_h == "" ? 0 : (dr[arrange_qty_h].ToString() != "" ? Convert.ToInt32(dr[arrange_qty_h]) : 0));
                        cpl_qty         = (cpl_qty_h == "" ? 0 : (dr[cpl_qty_h].ToString() != "" ? Convert.ToInt32(dr[cpl_qty_h]) : 0));
                        not_cpl_qty     = (not_cpl_qty_h == "" ? 0 : (dr[not_cpl_qty_h].ToString() != "" ? Convert.ToInt32(dr[not_cpl_qty_h]) : 0));
                        wp_id           = (wp_id_h == "" ? "" : dr[wp_id_h].ToString().Trim());
                        arrange_machine = (arrange_machine_h == "" ? "" : dr[arrange_machine_h].ToString().Trim());
                        string dtt = System.DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss");

                        //產生自動單號
                        arrange_seq = (i + 1).ToString().PadLeft(4, '0');
                        string id = prd_dep + dtt.Substring(0, 4) + dtt.Substring(5, 2) + dtt.Substring(8, 2) + dtt.Substring(11, 2) + dtt.Substring(14, 2) + dtt.Substring(17, 2) + arrange_seq;
                        strSql += string.Format(@" INSERT INTO product_arrange_jx (arrange_id,now_date,arrange_seq,prd_dep,arrange_date
                            ,prd_mo, prd_item, prd_seq, receive_date, prd_worker,wp_id,arrange_machine, delivery_date,arrange_qty,cpl_qty,not_cpl_qty
                            , mat_item, plan_date, estimated_date, remark, mat_status, outside, wash_oil,crusr,crtim)
                            VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}'
                            ,'{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}')"
                                                , id, now_date, arrange_seq, prd_dep, arrange_date, prd_mo, prd_item, prd_seq, receive_date, prd_worker, wp_id, arrange_machine
                                                , delivery_date, arrange_qty, cpl_qty, not_cpl_qty
                                                , mat_item, plan_date, pre_date, remark, mat_status, outside, wash_oil, user_id, dtt);

                        //result = sh.ExecuteSqlUpdate(strSql);//更新明細記錄
                        //if (result != "")
                        //    break;
                        //if (i == 2)
                        //    break;
                    }
                }
                strSql += string.Format(@" IF @@error <> 0 ");
                strSql += string.Format(@" ROLLBACK TRANSACTION ");
                strSql += string.Format(@" ELSE ");
                strSql += string.Format(@" COMMIT TRANSACTION ");

                //if (result == "")
                //{
                //    result = "匯入排期表成功!";
                //}
                //else
                //{
                //    result = "匯入排期表失敗!" + excel_row.ToString();

                //}


                if (strSql != "")
                {
                    result = sh.ExecuteSqlUpdate(strSql);//更新明細記錄
                    if (result == "")
                    {
                        result = "匯入排期表成功!";
                    }
                    StrHlp.WebMessageBox(this.Page, result);

                    //this.DataSetBand();
                }
                else
                {
                    result = "";
                }
            }
            //}
            catch (Exception ex)
            {
                result = "Excel文件的欄位不正確:(" + excel_row.ToString() + ")" + ex.Message;
            }
            if (result != "")
            {
                //Response.Write(String.Format("<script text='text/javascript'>alert('{0}')</script>", result_str));
                StrHlp.WebMessageBox(this.Page, result);
            }
        }
コード例 #20
0
        protected void UpdateStoreProcess(DataTable tblDatas)
        {
            string result     = "";
            bool   Valid_flag = true;
            string Flag_id    = "06";

            user_id = getUserName();
            string crtim = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            string Transfer_date;

            Transfer_date = txtDate.Value.ToString(); //System.DateTime.Now.ToString("yyyy/MM/dd");
            var query = from t in tblDatas.AsEnumerable()
                        group t by new { t1 = t.Field <string>("Loc_no"), t2 = t.Field <string>("Prd_item"), t3 = t.Field <string>("Prd_mo"), t4 = t.Field <string>("Lot_no") } into m
                select new
            {
                Loc_no   = m.Key.t1,
                Prd_item = m.Key.t2,
                Prd_mo   = m.Key.t3,
                Lot_no   = m.Key.t4,
                Qty      = m.Sum(n => n.Field <decimal>("Qty")),
                Weg      = m.Sum(n => n.Field <decimal>("Weg"))
            };

            foreach (var item in query.ToList())
            {
                string  Loc_no = "";
                string  Prd_item = "";
                string  Prd_mo = "ZZZZZZZZZ", Lot_no = "0000000000";
                decimal Qty = 0, Weg = 0;
                decimal wh_rec_qty = 0, wh_rec_weg = 0;
                decimal Transfer_qty = 0, Transfer_weg = 0;
                int     i      = 0;
                string  strSql = "";
                strSql += string.Format(@" SET XACT_ABORT  ON ");
                strSql += string.Format(@" BEGIN TRANSACTION ");

                Loc_no   = item.Loc_no.Trim().ToUpper();
                Prd_item = item.Prd_item.ToString().Trim();
                Prd_mo   = item.Prd_mo.ToString().Trim();
                Lot_no   = item.Lot_no.ToString().Trim();
                Qty      = Math.Round(item.Qty, 0);
                Weg      = Math.Round(item.Weg, 2);
                DataTable dtSt = CehckStore(Loc_no, Prd_item, Prd_mo, Lot_no);
                if (dtSt.Rows.Count == 0)
                {
                    Transfer_qty = Qty;
                    Transfer_weg = Weg;
                    wh_rec_qty   = Qty;
                    wh_rec_weg   = Weg;
                    strSql      += string.Format(@"Insert Into st_jx_store_summary (Loc_no,Prd_item,Prd_mo,Lot_no,wh_rec_weg,wh_rec_qty,crusr,crtim) Values " +
                                                 "('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')"
                                                 , Loc_no, Prd_item, Prd_mo, Lot_no, wh_rec_weg, wh_rec_qty, user_id, crtim);
                }
                else
                {
                    DataRow drSt = dtSt.Rows[0];
                    Transfer_qty = Qty - Convert.ToDecimal(drSt["wh_bal_qty"]);
                    Transfer_weg = Weg - Convert.ToDecimal(drSt["wh_bal_weg"]);
                    wh_rec_qty   = Convert.ToDecimal(drSt["wh_rec_qty"]) + Transfer_qty;
                    wh_rec_weg   = Convert.ToDecimal(drSt["wh_rec_weg"]) + Transfer_weg;
                    strSql      += string.Format(@"Update st_jx_store_summary Set wh_rec_weg='{0}',wh_rec_qty='{1}',crusr='******',crtim='{3}'" +
                                                 " Where Loc_no='{4}' And Prd_item='{5}' And Prd_mo='{6}' And Lot_no='{7}'"
                                                 , wh_rec_weg, wh_rec_qty, user_id, crtim, Loc_no, Prd_item, Prd_mo, Lot_no);
                }
                int    Seq = GenID(Loc_no, Flag_id, Transfer_date);
                string id  = "";
                id      = Loc_no + Flag_id + "-" + Transfer_date.Substring(2, 2) + Transfer_date.Substring(5, 2) + Transfer_date.Substring(8, 2) + (Seq + i).ToString().PadLeft(4, '0');
                strSql += string.Format(@"Insert Into st_jx_store_transfer (id,flag_id,transfer_date,Loc_no,prd_item,prd_mo,lot_no,transfer_qty,transfer_weg,crusr,crtim) Values " +
                                        "('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')"
                                        , id, Flag_id, Transfer_date, Loc_no, Prd_item, Prd_mo, Lot_no, Transfer_qty, Transfer_weg, user_id, crtim);

                strSql += string.Format(@" COMMIT TRANSACTION ");
                result  = sh.ExecuteSqlUpdate(strSql);//更新明細記錄
                if (result != "")
                {
                    Valid_flag = false;
                    result     = "匯入Excel失敗!";
                    break;
                }
                i = i + 1;
            }

            if (Valid_flag == true)
            {
                result = "匯入排期表成功!";
            }
            StrHlp.WebMessageBox(this.Page, result);
        }
コード例 #21
0
ファイル: pu_DeliverSetPrice.aspx.cs プロジェクト: cfmis/cfw
        protected void SaveProcess()
        {
            if (validSaveData() != "")
            {
                return;
            }
            string strSql = "";
            string result = "";

            for (int i = 0; i < gvDetails.Rows.Count; i++)
            {
                CheckBox chk = (CheckBox)gvDetails.Rows[i].FindControl("chkRec");
                if (chk.Checked == true)
                {
                    string       doc_id = gvDetails.Rows[i].Cells[1].Text.Trim();
                    string       seq = gvDetails.Rows[i].Cells[2].Text.Trim();
                    double       price, sec_price, mould_fee, former_free, qty, weg;
                    string       process_request;
                    string       p_unit, sec_p_unit;
                    TextBox      tx = new TextBox();
                    DropDownList dl = new DropDownList();
                    tx     = (TextBox)gvDetails.Rows[i].FindControl("txtPrice");
                    price  = tx.Text != "" ? Convert.ToDouble(tx.Text) : 0;
                    dl     = (DropDownList)gvDetails.Rows[i].FindControl("dlP_unit");
                    p_unit = dl.Text;
                    double rate = getUnitRate(p_unit);
                    tx              = (TextBox)gvDetails.Rows[i].FindControl("txtSec_price");
                    sec_price       = tx.Text != "" ? Convert.ToDouble(tx.Text) : 0;
                    tx              = (TextBox)gvDetails.Rows[i].FindControl("txtMould_fee");
                    mould_fee       = tx.Text != "" ? Convert.ToDouble(tx.Text) : 0;
                    tx              = (TextBox)gvDetails.Rows[i].FindControl("txtFormer_free");
                    former_free     = tx.Text != "" ? Convert.ToDouble(tx.Text) : 0;
                    tx              = (TextBox)gvDetails.Rows[i].FindControl("txtProcess_request");
                    process_request = tx.Text;
                    dl              = (DropDownList)gvDetails.Rows[i].FindControl("dlSec_p_unit");
                    sec_p_unit      = dl.Text;
                    qty             = Convert.ToDouble(gvDetails.Rows[i].Cells[14].Text);
                    weg             = Convert.ToDouble(gvDetails.Rows[i].Cells[15].Text);
                    double total_prices = Math.Round(qty * (price / rate) + weg * sec_price + mould_fee + former_free, 2);
                    strSql += string.Format(@"UPDATE " + remote_db + "op_outpro_out_displace SET price='{0}',sec_price='{1}',mould_fee='{2}',former_free='{3}',process_request='{4}'" +
                                            ",p_unit='{5}',sec_p_unit='{6}',total_prices='{7}'" +
                                            " WHERE within_code='{8}' AND id='{9}' AND sequence_id='{10}' "
                                            , price, sec_price, mould_fee, former_free, process_request, p_unit, sec_p_unit, total_prices, within_code, doc_id, seq);
//                    strSql += string.Format(@"UPDATE pu_deliver_details SET act_in_weg=act_in_weg+'{0}',act_in_qty=act_in_qty+'{1}',act_in_date='{2}'
//                                ,crusr='******',crtim=GETDATE()
//                                WHERE doc_id='{4}' AND seq='{5}' ", act_in_weg, act_in_qty, act_in_date, user_id, ref_doc_id, ref_seq);
                }
            }
            if (strSql != "")
            {
                result = sh.ExecuteSqlUpdate(strSql);
                if (result == "")
                {
                    chkSelectAll.Checked = false;
                    result = "更新單價成功!";
                }
            }
            StrHlp.WebMessageBox(this.Page, result);
            //Response.Write(String.Format("<script text='text/javascript'>alert('{0}')</script>", result));

            loadData();
        }
コード例 #22
0
ファイル: Pd_Mo_Arrange_Imput.aspx.cs プロジェクト: cfmis/cfw
        /// <summary>
        /// 数据集操作
        /// </summary>
        /// <param name="ds"></param>
        /// 更新Excel表到临时表pu_temp_excel中
        private void DtOperator(DataTable dt, string fileName, string sheetName)
        {
            bool   upd_flag = true;
            string result_str = "";
            string strSql = "", strSql_f = "";

            imgProcess.Visible = true;
            string now_date, prd_dep = "102";
            int    excel_row = 1;

            //string[] proSub = Request.Form.GetValues("selDep");
            //prd_dep = proSub[selDep.SelectedIndex];
            prd_dep  = dlDep.SelectedValue.ToString().Trim();
            now_date = txtArrangeDate.Value; //System.DateTime.Now.ToString("yyyy/MM/dd");
            string prd_mo, prd_item, urgent_status1, urgent_status, arrange_date, arrange_machine, cust_o_date = "", req_f_date, dep_rep_date, req_hk_date, dep_group;
            string pre_prd_dep_date = "";
            int    pre_prd_dep_qty = 0;
            int    arrange_seq, order_qty, req_qty, cpl_qty, arrange_qty, prd_cpl_qty;
            string prd_status = "00";//
            string rec_status = "0";

            user_id = getUserName();
            string strDep = fileName.Substring(0, 3);

            dep_group = "";
            if (prd_dep == "102")
            {
                if (fileName.Substring(0, 3) == "萬能機")
                {
                    dep_group = "A";
                }
                else
                {
                    if (fileName.Substring(0, 2) == "雞眼")
                    {
                        dep_group = "B";
                    }
                }
            }
            //strSql += string.Format(@"Delete From product_arrange Where prd_dep='{0}' and now_date='{1}'", prd_dep, now_date);
            try
            {
                string arrange_seq_h = "", prd_mo_h = "", urgent_status_h = "", prd_item_h = "", cust_o_date_h = "", req_f_date_h = "", order_qty_h = "", cpl_qty_h = ""
                , arrange_date_h = "", arrange_qty_h = "", req_qty_h = "", prd_cpl_qty_h = "", dep_rep_date_h = "", arrange_machine_h = ""
                , req_hk_date_h = "", dep_group_h1 = "", dep_group_h2 = "", dep_group_h3 = ""
                , pre_prd_dep_date_h = "", pre_prd_dep_qty_h = "";
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    string colName = dt.Columns[j].ColumnName;
                    arrange_seq_h      = (colName == "序號" ? colName : arrange_seq_h);
                    prd_mo_h           = (colName == "制單編號" || colName == "頁數" ? colName : prd_mo_h);
                    urgent_status_h    = (colName == "急單" || colName == "状态" || colName == "狀態" ? colName : urgent_status_h);
                    arrange_date_h     = (colName == "排期日期" || colName == "排期日期AA" || colName == "排期" ? colName : arrange_date_h);
                    prd_item_h         = (colName == "產品編號" || colName == "物料編號" ? colName : prd_item_h);
                    cust_o_date_h      = (colName == "客落單日期" ? colName : cust_o_date_h);
                    req_f_date_h       = (colName == "要求完成時間" || colName == "pmc要求完成日期" ? colName : req_f_date_h);
                    order_qty_h        = (colName == "訂單數量" ? colName : order_qty_h);
                    req_qty_h          = (colName == "要求數量" || colName == "應生產數量" ? colName : req_qty_h);
                    cpl_qty_h          = (colName == "完成數量" || colName == "已完成數量" ? colName : cpl_qty_h);
                    arrange_qty_h      = (colName == "待完成數量" ? colName : arrange_qty_h);
                    prd_cpl_qty_h      = (colName == "生產數量" ? colName : prd_cpl_qty_h);
                    dep_rep_date_h     = (colName == "部門回覆" || colName == "部門覆期" || colName == "部門復期" ? colName : dep_rep_date_h);
                    arrange_machine_h  = (colName == "生產設備" ? colName : arrange_machine_h);
                    req_hk_date_h      = (colName == "計劃回港期" || colName == "計劃回港日期" || colName == "回港期" ? colName : req_hk_date_h);
                    dep_group_h1       = (colName == "自動" || colName == "组別" || colName == "組別" ? colName : dep_group_h1);
                    dep_group_h2       = (colName == "打扣" ? colName : dep_group_h2);
                    dep_group_h3       = (colName == "車碑" ? colName : dep_group_h3);
                    pre_prd_dep_date_h = (colName == "上部門來貨期" ? colName : pre_prd_dep_date_h);
                    pre_prd_dep_qty_h  = (colName == "上部門來貨數量" ? colName : pre_prd_dep_qty_h);
                }


                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    strSql    = "";
                    excel_row = excel_row + 1;
                    DataRow dr = dt.Rows[i];
                    //if (i == 577)
                    //{
                    //    int aa = 1;
                    //}
                    arrange_seq = (arrange_seq_h == "" ? 0 : (dr[arrange_seq_h].ToString() != "" ? Convert.ToInt32(dr[arrange_seq_h]) : 0));
                    prd_mo      = (prd_mo_h == "" ? "" : dr[prd_mo_h].ToString().Trim());
                    if (prd_mo != "")
                    {
                        arrange_date   = (arrange_date_h == "" ? "" : (dr[arrange_date_h].ToString() != "" ? Convert.ToDateTime(dr[arrange_date_h].ToString()).ToString("yyyy/MM/dd") : ""));
                        urgent_status1 = (urgent_status_h == "" ? "" : dr[urgent_status_h].ToString().Trim());
                        urgent_status  = "";
                        if (urgent_status1 == "超特急")
                        {
                            urgent_status = "04";
                        }
                        else
                        {
                            if (urgent_status1 == "特急")
                            {
                                urgent_status = "03";
                            }
                            else
                            {
                                if (urgent_status1 == "急單" || urgent_status1 == "急")
                                {
                                    urgent_status = "02";
                                }
                                else
                                {
                                    urgent_status = "00";
                                }
                            }
                        }
                        prd_item = (prd_item_h == "" ? "" : dr[prd_item_h].ToString());

                        cust_o_date = (cust_o_date_h == "" ? "" : (dr[cust_o_date_h].ToString() != "" ? Convert.ToDateTime(dr[cust_o_date_h].ToString()).ToString("yyyy/MM/dd") : ""));
                        req_f_date  = (req_f_date_h == "" ? "" : (dr[req_f_date_h].ToString() != "" ? Convert.ToDateTime(dr[req_f_date_h].ToString()).ToString("yyyy/MM/dd") : ""));
                        order_qty   = (order_qty_h == "" ? 0 : (dr[order_qty_h].ToString() != "" ? Convert.ToInt32(dr[order_qty_h]) : 0));
                        req_qty     = (req_qty_h == "" ? 0 : (dr[req_qty_h].ToString() != "" ? Convert.ToInt32(dr[req_qty_h]) : 0));
                        cpl_qty     = (cpl_qty_h == "" ? 0 : (dr[cpl_qty_h].ToString() != "" ? Convert.ToInt32(dr[cpl_qty_h]) : 0));
                        arrange_qty = (arrange_qty_h == "" ? 0 : (dr[arrange_qty_h].ToString() != "" ? Convert.ToInt32(dr[arrange_qty_h]) : 0));
                        prd_cpl_qty = (prd_cpl_qty_h == "" ? 0 : (dr[prd_cpl_qty_h].ToString() != "" ? Convert.ToInt32(dr[prd_cpl_qty_h]) : 0));
                        //dep_rep_date = (dep_rep_date_h == "" ? "" : (dr[dep_rep_date_h].ToString() != "" ? Convert.ToDateTime(dr[dep_rep_date_h].ToString()).ToString("yyyy/MM/dd") : ""));
                        dep_rep_date     = (dep_rep_date_h == "" ? "" : (dr[dep_rep_date_h].ToString() != "" ? dr[dep_rep_date_h].ToString() : ""));
                        arrange_machine  = (arrange_machine_h == "" ? "" : dr[arrange_machine_h].ToString());
                        req_hk_date      = (req_hk_date_h == "" ? "" : (dr[req_hk_date_h].ToString() != "" ? Convert.ToDateTime(dr[req_hk_date_h].ToString()).ToString("yyyy/MM/dd") : ""));
                        pre_prd_dep_date = (pre_prd_dep_date_h == "" ? "" : dr[pre_prd_dep_date_h].ToString());
                        pre_prd_dep_qty  = (pre_prd_dep_qty_h == "" ? 0 : (dr[pre_prd_dep_qty_h].ToString() != "" ? Convert.ToInt32(dr[pre_prd_dep_qty_h]) : 0));
                        if (prd_dep == "202")
                        {
                            dep_group = (dep_group_h1 == "" ? "" : dr[dep_group_h1].ToString());//自動
                            if (dep_group != "")
                            {
                                dep_group = "A";
                            }
                            else
                            {
                                if (dep_group == "")
                                {
                                    dep_group = (dep_group_h2 == "" ? "" : dr[dep_group_h2].ToString());//打扣
                                    if (dep_group != "")
                                    {
                                        dep_group = "B";
                                    }
                                    else
                                    {
                                        if (dep_group == "")
                                        {
                                            dep_group = (dep_group_h3 == "" ? "" : dr[dep_group_h3].ToString());//車碑
                                            if (dep_group != "")
                                            {
                                                dep_group = "C";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            dep_group = (dep_group_h1 == "" ? "" : dr[dep_group_h1].ToString());
                        }
                        string dtt = System.DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss");

                        strSql_f = "Select arrange_id From dgcf_pad.dbo.product_arrange Where prd_dep='" + prd_dep + "' And now_date='" + now_date + "' And prd_mo='" + prd_mo + "' And prd_item='" + prd_item + "'";
                        DataTable dtArrange = sh.ExecuteSqlReturnDataTable(strSql_f);
                        if (dtArrange.Rows.Count == 0)
                        {
                            //產生自動單號
                            string id = prd_dep + dtt.Substring(0, 4) + dtt.Substring(5, 2) + dtt.Substring(8, 2) + dtt.Substring(11, 2) + dtt.Substring(14, 2) + dtt.Substring(17, 2) + (i + 1).ToString().PadLeft(4, '0');
                            //string prd_seq = "01";
                            strSql += string.Format(@"INSERT INTO dgcf_pad.dbo.product_arrange (arrange_id,now_date,prd_dep,prd_mo,prd_item,mo_urgent,arrange_machine,arrange_date,arrange_seq,order_qty
                            ,cust_o_date,req_f_date,req_qty,cpl_qty,arrange_qty,prd_cpl_qty,dep_rep_date,rec_status,prd_status,req_hk_date,dep_group,pre_prd_dep_date,pre_prd_dep_qty,crusr,crtim)
                            VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}',GETDATE())"
                                                    , id, now_date, prd_dep, prd_mo, prd_item, urgent_status, arrange_machine, arrange_date, arrange_seq, order_qty
                                                    , cust_o_date, req_f_date, req_qty, cpl_qty, arrange_qty, prd_cpl_qty, dep_rep_date, rec_status, prd_status, req_hk_date, dep_group, pre_prd_dep_date, pre_prd_dep_qty, user_id);
                        }
                        else
                        {
                            string arrange_id = dtArrange.Rows[0]["arrange_id"].ToString();
                            strSql += string.Format(@"Update dgcf_pad.dbo.product_arrange Set mo_urgent='{0}',arrange_machine='{1}',arrange_date='{2}',arrange_seq='{3}'
                            ,order_qty='{4}',cust_o_date='{5}',req_f_date='{6}',req_qty='{7}',cpl_qty='{8}',arrange_qty='{9}',prd_cpl_qty='{10}'
                            ,dep_rep_date='{11}',rec_status='{12}',prd_status='{13}',req_hk_date='{14}',dep_group='{15}',now_date='{16}',pre_prd_dep_date='{17}',pre_prd_dep_qty='{18}',amusr='******'
                            ,amtim=GETDATE() Where arrange_id='{20}'"
                                                    , urgent_status, arrange_machine, arrange_date, arrange_seq, order_qty, cust_o_date, req_f_date, req_qty
                                                    , cpl_qty, arrange_qty, prd_cpl_qty, dep_rep_date, rec_status, prd_status, req_hk_date, dep_group, now_date, pre_prd_dep_date, pre_prd_dep_qty, user_id, arrange_id);
                        }
                        result_str = sh.ExecuteSqlUpdate(strSql);//更新明細記錄
                        if (result_str != "")
                        {
                            upd_flag = false;
                            break;
                        }
                    }
                }
                imgProcess.Visible = false;
                if (upd_flag)
                {
                    StrHlp.WebMessageBox(this.Page, "匯入排期表成功!");
                }
                else
                {
                    StrHlp.WebMessageBox(this.Page, "匯入排期表失敗,記錄: " + excel_row.ToString() + " " + result_str);
                }
                //if (strSql != "")
                //{
                //    result_str = sh.ExecuteSqlUpdate(strSql);//更新明細記錄
                //    if (result_str == "")
                //        StrHlp.WebMessageBox(this.Page, "匯入排期表成功!");
                //    else
                //        StrHlp.WebMessageBox(this.Page, "匯入排期表失敗:"+ result_str);
                //}
                //else
                //{
                //    result_str = "";

                //}
            }
            catch (Exception ex)
            {
                result_str = "Excel文件的欄位不正確,行:" + excel_row.ToString() + " " + ex.Message;
            }
            imgProcess.Visible = false;
            if (result_str != "")
            {
                //Response.Write(String.Format("<script text='text/javascript'>alert('{0}')</script>", result_str));
                StrHlp.WebMessageBox(this.Page, result_str);
            }
        }
コード例 #23
0
ファイル: Pd_Mo_Plan_New.aspx.cs プロジェクト: cfmis/cfw
        /// <summary>
        /// 数据集操作
        /// </summary>
        /// <param name="ds"></param>
        /// 更新Excel表到临时表pu_temp_excel中
        private void DataSetOperator(DataTable dt)
        {
            string result_str = "";
            string strSql = "", strSql_f = "";


            string now_date, prd_dep = "102";
            int    excel_row = 0;

            //string[] proSub = Request.Form.GetValues("selDep");
            //prd_dep = proSub[selDep.SelectedIndex];
            prd_dep  = dlDep.SelectedValue.ToString().Trim();
            now_date = dateArrange.Value; //System.DateTime.Now.ToString("yyyy/MM/dd");
            string prd_mo, prd_item, urgent_status1, urgent_status, arrange_date, arrange_machine, order_date = "", req_time, dep_rep_date;
            int    arrange_seq, order_qty, req_qty, cpl_qty, wait_cpl_qty, prd_cpl_qty;

            user_id = getUserName();
            //strSql += string.Format(@"Delete From product_arrange Where prd_dep='{0}' and now_date='{1}'", prd_dep, now_date);
            try
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    excel_row = excel_row + 1;
                    DataRow dr = dt.Rows[i];
                    arrange_seq = (dr[0].ToString() != "" ? Convert.ToInt32(dr[0]) : 0);
                    prd_mo      = dr[1].ToString();
                    if (prd_mo != "")
                    {
                        arrange_date   = (dr[2].ToString() != "" ? Convert.ToDateTime(dr[2].ToString()).ToString("yyyy/MM/dd") : "");
                        urgent_status1 = dr[3].ToString();
                        urgent_status  = "";
                        if (urgent_status1 == "超特急")
                        {
                            urgent_status = "01";
                        }
                        else
                        {
                            if (urgent_status1 == "特急")
                            {
                                urgent_status = "02";
                            }
                            else
                            {
                                if (urgent_status1 == "急單" || urgent_status1 == "急")
                                {
                                    urgent_status = "03";
                                }
                            }
                        }
                        prd_item = dr[4].ToString();

                        order_date      = (dr[7].ToString() != "" ? Convert.ToDateTime(dr[7].ToString()).ToString("yyyy/MM/dd") : "");
                        req_time        = (dr[9].ToString() != "" ? Convert.ToDateTime(dr[9].ToString()).ToString("yyyy/MM/dd") : "");
                        order_qty       = (dr[10].ToString() != "" ? Convert.ToInt32(dr[10]) : 0);
                        req_qty         = (dr[11].ToString() != "" ? Convert.ToInt32(dr[11]) : 0);
                        cpl_qty         = (dr[12].ToString() != "" ? Convert.ToInt32(dr[12]) : 0);
                        wait_cpl_qty    = (dr[13].ToString() != "" ? Convert.ToInt32(dr[13]) : 0);
                        prd_cpl_qty     = (dr[14].ToString() != "" ? Convert.ToInt32(dr[14]) : 0);
                        dep_rep_date    = (dr[16].ToString() != "" ? Convert.ToDateTime(dr[16].ToString()).ToString("yyyy/MM/dd") : "");
                        arrange_machine = dr[17].ToString();
                        string dtt = System.DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss");
                        string id  = prd_dep + dtt.Substring(0, 4) + dtt.Substring(5, 2) + dtt.Substring(8, 2) + dtt.Substring(11, 2) + dtt.Substring(14, 2) + dtt.Substring(17, 2) + (i + 1).ToString().PadLeft(4, '0');
                        strSql_f = "Select prd_mo From product_arrange Where prd_dep='" + prd_dep + "' And now_date='" + now_date + "' And prd_mo='" + prd_mo + "' And prd_item='" + prd_item + "'";
                        if (sh.ExecuteSqlReturnDataTable(strSql_f).Rows.Count == 0)
                        {
                            strSql += string.Format(@"INSERT INTO product_arrange (arrange_id,now_date,prd_dep,prd_mo,prd_item,urgent_status,arrange_machine,arrange_date,arrange_seq,order_qty
                            ,order_date,req_time,req_qty,cpl_qty,wait_cpl_qty,prd_cpl_qty,dep_rep_date,crusr,crtim)
                            VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}',GETDATE())"
                                                    , id, now_date, prd_dep, prd_mo, prd_item, urgent_status, arrange_machine, arrange_date, arrange_seq, order_qty
                                                    , order_date, req_time, req_qty, cpl_qty, wait_cpl_qty, prd_cpl_qty, dep_rep_date, user_id);
                        }
                        else
                        {
                            strSql += string.Format(@"Update product_arrange Set urgent_status='{0}',arrange_machine='{1}',arrange_date='{2}',arrange_seq='{3}'
                            ,order_qty='{4}',order_date='{5}',req_time='{6}',req_qty='{7}',cpl_qty='{8}',wait_cpl_qty='{9}',prd_cpl_qty='{10}'
                            ,dep_rep_date='{11}',amusr='******',amtim=GETDATE() Where prd_dep='{13}' And now_date='{14}' And prd_mo='{15}' And prd_item='{16}'"
                                                    , urgent_status, arrange_machine, arrange_date, arrange_seq, order_qty
                                                    , order_date, req_time, req_qty, cpl_qty, wait_cpl_qty, prd_cpl_qty, dep_rep_date, user_id, prd_dep, now_date, prd_mo, prd_item);
                        }
                    }
                }


                if (strSql != "")
                {
                    result_str = sh.ExecuteSqlUpdate(strSql);//更新明細記錄
                }
                else
                {
                    result_str = "";
                }
            }
            catch (Exception ex)
            {
                result_str = "Excel文件的欄位不正確:(" + excel_row.ToString() + ")" + ex.Message;
            }
            if (result_str != "")
            {
                //Response.Write(String.Format("<script text='text/javascript'>alert('{0}')</script>", result_str));
                StrHlp.WebMessageBox(this.Page, result_str);
            }
        }
コード例 #24
0
        /// <summary>
        /// 数据集操作
        /// </summary>
        /// <param name="ds"></param>
        /// 更新Excel表到临时表pu_temp_excel中
        private void DataSetOperator(DataTable dt, string fileName)
        {
            string result_str = "";
            string strSql = "", strSql_f = "";
            int    excel_row = 0;
            string prd_mo, urgent_status, urgent_status1 = "";

            user_id = getUserName();
            //strSql += string.Format(@"Delete From product_arrange Where prd_dep='{0}' and now_date='{1}'", prd_dep, now_date);
            try
            {
                string prd_mo_h = "", urgent_status_h = "";
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    string colName = dt.Columns[j].ColumnName;
                    prd_mo_h        = (colName == "制單編號" || colName == "頁數" || colName == "未完成頁數" ? colName : prd_mo_h);
                    urgent_status_h = (colName == "急單" || colName == "状态" || colName == "狀態" || colName == "急/特急狀態" ? colName : urgent_status_h);
                }


                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    excel_row = excel_row + 1;
                    prd_mo    = (prd_mo_h == "" ? "" : dr[prd_mo_h].ToString().Trim());
                    if (prd_mo != "")
                    {
                        urgent_status1 = (urgent_status_h == "" ? "" : dr[urgent_status_h].ToString().Trim());
                        urgent_status  = "";
                        if (urgent_status1 == "超特急")
                        {
                            urgent_status = "04";
                        }
                        else
                        {
                            if (urgent_status1 == "特急")
                            {
                                urgent_status = "03";
                            }
                            else
                            {
                                if (urgent_status1 == "急單" || urgent_status1 == "急")
                                {
                                    urgent_status = "02";
                                }
                                else
                                {
                                    urgent_status = "00";
                                }
                            }
                        }

                        strSql_f = "Select mo_id From mo_status Where mo_id='" + prd_mo + "'";
                        DataTable dtArrange = sh.ExecuteSqlReturnDataTable(strSql_f);
                        if (dtArrange.Rows.Count == 0)
                        {
                            strSql += string.Format(@"INSERT INTO mo_status (mo_id,mo_status,cr_usr,cr_tim)
                            VALUES ('{0}','{1}','{2}',GETDATE())", prd_mo, urgent_status, user_id);
                        }
                        else
                        {
                            strSql += string.Format(@"Update  mo_status Set mo_status='{0}',am_usr='******'
                            ,am_tim=GETDATE() Where mo_id='{2}'", urgent_status, user_id, prd_mo);
                        }
                    }
                }

                if (strSql != "")
                {
                    result_str = sh.ExecuteSqlUpdate(strSql);//更新明細記錄
                    StrHlp.WebMessageBox(this.Page, "更新制單狀態成功!");
                }
                else
                {
                    result_str = "";
                }
            }
            catch (Exception ex)
            {
                result_str = "Excel文件的欄位不正確:(" + excel_row.ToString() + ")" + ex.Message;
            }
            if (result_str != "")
            {
                //Response.Write(String.Format("<script text='text/javascript'>alert('{0}')</script>", result_str));
                StrHlp.WebMessageBox(this.Page, result_str);
            }
        }
コード例 #25
0
        /// <summary>
        /// 数据集操作
        /// </summary>
        /// <param name="ds"></param>
        /// 更新Excel表到临时表pu_temp_excel中
        private void DataSetOperator(DataTable dt, string fileName)
        {
            string result_str = "";
            string strSql = "", strSql_f = "";


            string now_date, prd_dep = "501";
            int    excel_row = 0;

            //string[] proSub = Request.Form.GetValues("selDep");
            //prd_dep = proSub[selDep.SelectedIndex];
            prd_dep = dlDep.SelectedValue.ToString().Trim();

            string vendor_id, prd_mo, prd_item, remark;

            user_id = getUserName();

            try
            {
                string vend_h = "", prd_mo_h = "", prd_item_h = "", remark_h = "";
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    string colName = dt.Columns[j].ColumnName;
                    vend_h     = (colName == "供應商" ? colName : vend_h);
                    prd_mo_h   = (colName == "頁數" ? colName : prd_mo_h);
                    prd_item_h = (colName == "貨品編碼" ? colName : prd_item_h);
                    remark_h   = (colName == "電鍍回覆" ? colName : remark_h);
                }
                if (vend_h == "" || prd_mo_h == "" || prd_item_h == "" || remark_h == "")
                {
                    StrHlp.WebMessageBox(this.Page, "Excel文件第一行必須為有效的表頭格式:供應商 -- 頁數 -- 貨品編碼--電鍍回覆!");
                    return;
                }


                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    excel_row = excel_row + 1;
                    DataRow dr = dt.Rows[i];

                    prd_mo = (prd_mo_h == "" ? "" : dr[prd_mo_h].ToString().Trim());
                    if (prd_mo != "")
                    {
                        vendor_id = (prd_item_h == "" ? "" : dr[vend_h].ToString());
                        prd_item  = (prd_item_h == "" ? "" : dr[prd_item_h].ToString());
                        remark    = (remark_h == "" ? "" : dr[remark_h].ToString());

                        strSql_f = "Select mo_id From mo_outside_rework_mark Where dep_id='" + prd_dep + "' And vendor_id='" + vendor_id + "' And mo_id='" + prd_mo + "' And goods_id='" + prd_item + "'";
                        DataTable dtArrange = sh.ExecuteSqlReturnDataTable(strSql_f);
                        if (dtArrange.Rows.Count == 0)
                        {
                            //產生自動單號

                            strSql += string.Format(@"INSERT INTO mo_outside_rework_mark (dep_id,vendor_id,mo_id,goods_id,remark,crusr,crtim)
                            VALUES ('{0}','{1}','{2}','{3}','{4}','{5}',GETDATE())"
                                                    , prd_dep, vendor_id, prd_mo, prd_item, remark, user_id);
                        }
                        else
                        {
                            strSql += string.Format(@"Update mo_outside_rework_mark Set remark='{0}',crusr='******'
                            ,crtim=GETDATE() Where dep_id='{2}' And vendor_id='{3}' And mo_id='{4}' And goods_id='{5}'"
                                                    , remark, user_id, prd_dep, vendor_id, prd_mo, prd_item);
                        }
                    }
                }

                if (strSql != "")
                {
                    result_str = sh.ExecuteSqlUpdate(strSql);//更新明細記錄
                    StrHlp.WebMessageBox(this.Page, "匯入電鍍回覆成功!");
                    this.DataSetBand();
                }
                else
                {
                    result_str = "";
                }
            }
            catch (Exception ex)
            {
                result_str = "Excel文件的欄位不正確:(" + excel_row.ToString() + ")" + ex.Message;
            }
            if (result_str != "")
            {
                //Response.Write(String.Format("<script text='text/javascript'>alert('{0}')</script>", result_str));
                StrHlp.WebMessageBox(this.Page, result_str);
            }
        }