Browse Source

Merge branch 'master' of ssh://10.10.100.21/source/mes-client

Hcsy 8 years ago
parent
commit
16a913b20e

+ 11 - 18
UAS-MES/FunctionCode/Make/Make_CustomLabelPrint.cs

@@ -106,11 +106,9 @@ namespace UAS_MES.Make
                     //说明没有默认的模板,那就取pl_id最大的
                     //说明没有默认的模板,那就取pl_id最大的
                     listA = (DataTable)dh.ExecuteSql("select la_code,la_id,substr(la_url,instr(la_url,'\\',-1)+1)la_name,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='自定义' and la_statuscode='AUDITED' order by la_isdefault", "select");
                     listA = (DataTable)dh.ExecuteSql("select la_code,la_id,substr(la_url,instr(la_url,'\\',-1)+1)la_name,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='自定义' and la_statuscode='AUDITED' order by la_isdefault", "select");
                 }
                 }
-                //下载标签
-                getLabels();
                 //标签显示
                 //标签显示
                 PrintLabel.DataSource = listA;
                 PrintLabel.DataSource = listA;
-                PrintLabel.DisplayMember = "la_name";
+                PrintLabel.DisplayMember = "la_url";
                 PrintLabel.ValueMember = "la_id";
                 PrintLabel.ValueMember = "la_id";
                 //有值,填充界面
                 //有值,填充界面
                 BaseUtil.SetFormValue(this.Controls, dt);
                 BaseUtil.SetFormValue(this.Controls, dt);
@@ -147,7 +145,7 @@ namespace UAS_MES.Make
                     {
                     {
                         inputValues = new string[paramsInfo.Rows.Count];
                         inputValues = new string[paramsInfo.Rows.Count];
                         sb = new StringBuilder();
                         sb = new StringBuilder();
-                        doc = lbl.Documents.Open(ftpOperater.DownLoadTo + listA.Rows[PrintLabel.SelectedIndex]["la_name"].ToString());
+                        doc = lbl.Documents.Open(listA.Rows[PrintLabel.SelectedIndex]["la_url"].ToString());
                     }
                     }
                     //将值赋到doc对应的变量
                     //将值赋到doc对应的变量
                     for (int i = 0; i < doc.Variables.FormVariables.Count; i++)
                     for (int i = 0; i < doc.Variables.FormVariables.Count; i++)
@@ -183,10 +181,12 @@ namespace UAS_MES.Make
                         //打印
                         //打印
                         LogManager.DoLog(sb.ToString());
                         LogManager.DoLog(sb.ToString());
                         //保存本次赋值进行打印
                         //保存本次赋值进行打印
-                        doc.Save();
                         doc.Printer.SwitchTo(Printer.Text);
                         doc.Printer.SwitchTo(Printer.Text);
                         doc.PrintDocument(int.Parse(PrintNum.Text));
                         doc.PrintDocument(int.Parse(PrintNum.Text));
-                        doc.Close();
+                        for (int i = 0; i < doc.Variables.FormVariables.Count; i++)
+                        {
+                            doc.Variables.FormVariables.Item(i + 1).Value = null;
+                        }
                         //讲文件最后写入时间改成数据库中拿到的时间
                         //讲文件最后写入时间改成数据库中拿到的时间
                         //记录打印日志
                         //记录打印日志
                         LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "自定义标打印", "成功打印", "", "");
                         LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "自定义标打印", "成功打印", "", "");
@@ -206,15 +206,6 @@ namespace UAS_MES.Make
             }
             }
         }
         }
 
 
-        private void getLabels()
-        {
-            //ftp = new ftpOperater();
-            for (int i = 0; i < listA.Rows.Count; i++)
-            {
-                BaseUtil.GetPrintLabel(listA.Rows[i]["la_name"].ToString(), listA.Rows[i]["la_url"].ToString());
-            }
-        }
-
         private void PrintLabel_TextChanged(object sender, EventArgs e)
         private void PrintLabel_TextChanged(object sender, EventArgs e)
         {
         {
             if (PrintLabel.Text.StartsWith("System"))
             if (PrintLabel.Text.StartsWith("System"))
@@ -258,7 +249,7 @@ namespace UAS_MES.Make
         {
         {
             if (canPrint)
             if (canPrint)
             {
             {
-                doc = lbl.Documents.Open(ftpOperater.DownLoadTo + listA.Rows[PrintLabel.SelectedIndex]["la_name"].ToString());
+                doc = lbl.Documents.Open(listA.Rows[PrintLabel.SelectedIndex]["la_url"].ToString());
                 sb = new StringBuilder();
                 sb = new StringBuilder();
                 //将值赋到doc对应的变量
                 //将值赋到doc对应的变量
                 for (int i = 0; i < doc.Variables.FormVariables.Count; i++)
                 for (int i = 0; i < doc.Variables.FormVariables.Count; i++)
@@ -276,10 +267,12 @@ namespace UAS_MES.Make
                 //打印
                 //打印
                 LogManager.DoLog(sb.ToString());
                 LogManager.DoLog(sb.ToString());
                 //保存本次赋值进行打印
                 //保存本次赋值进行打印
-                doc.Save();
                 doc.Printer.SwitchTo(Printer.Text);
                 doc.Printer.SwitchTo(Printer.Text);
                 doc.PrintDocument(int.Parse(PrintNum.Text));
                 doc.PrintDocument(int.Parse(PrintNum.Text));
-                doc.Close();
+                for (int i = 0; i < doc.Variables.FormVariables.Count; i++)
+                {
+                    doc.Variables.FormVariables.Item(i + 1).Value = null;
+                }
                 //讲文件最后写入时间改成数据库中拿到的时间
                 //讲文件最后写入时间改成数据库中拿到的时间
                 //记录打印日志
                 //记录打印日志
                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "自定义标打印", "成功打印", "", "");
                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "自定义标打印", "成功打印", "", "");

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -270,7 +270,7 @@ namespace UAS_MES.Make
                         string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
                         string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
                         if (nextstepcode != "" && nextstepcode != User.CurrentStepCode)
                         if (nextstepcode != "" && nextstepcode != User.CurrentStepCode)
                         {
                         {
-                            OperateResult.AppendText("当前序列号下一道工序" + nextstepcode, Color.Red);
+                            OperateResult.AppendText("当前序列号下一道工序为" + nextstepcode+"\n", Color.Red);
                             return;
                             return;
                         }
                         }
                         //PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
                         //PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();

+ 5 - 5
UAS-MES/FunctionCode/Warehouse/Warehouse_FinishedProductOut.cs

@@ -217,7 +217,7 @@ namespace UAS_MES.Warehouse
                             ExeSQL.Add("update prodinout set pi_pdastatus='已出库' where pi_inoutno='" + pi_inoutno.Text + "'");
                             ExeSQL.Add("update prodinout set pi_pdastatus='已出库' where pi_inoutno='" + pi_inoutno.Text + "'");
                             ExeSQL.Add("insert into messagelog(ml_id,ml_date,ml_man,ml_content,ml_result,ml_search)values(messagelog_seq.nextval,sysdate,'" + User.UserName + "','确认出货','确认出货成功','ProdInOut!Sale|pi_id=" + pi_id.Text + "')");
                             ExeSQL.Add("insert into messagelog(ml_id,ml_date,ml_man,ml_content,ml_result,ml_search)values(messagelog_seq.nextval,sysdate,'" + User.UserName + "','确认出货','确认出货成功','ProdInOut!Sale|pi_id=" + pi_id.Text + "')");
                             dh.ExecuteSQLTran(ExeSQL.ToArray());
                             dh.ExecuteSQLTran(ExeSQL.ToArray());
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "出货单" + pi_inoutno.Text + "确认出货", "出货单" + pi_inoutno.Text + "确认出货成功", "", pi_inoutno.Text);
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "出货单" + pi_inoutno.Text + "确认出货", "出货单" + pi_inoutno.Text + "确认出货成功", pi_inoutno.Text,"");
                             OperateResult.AppendText("出货单" + pi_inoutno.Text + "出库成功\n", Color.Black, pi_inoutno);
                             OperateResult.AppendText("出货单" + pi_inoutno.Text + "出库成功\n", Color.Black, pi_inoutno);
                             BaseUtil.CleanDGVData(InOutDetailDGV);
                             BaseUtil.CleanDGVData(InOutDetailDGV);
                             BaseUtil.CleanControls(panel1.Controls);
                             BaseUtil.CleanControls(panel1.Controls);
@@ -290,7 +290,7 @@ namespace UAS_MES.Warehouse
                                 v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
                                 v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
                             }
                             }
                             dh.BatchInsert("update makeserial set ms_outno='" + pi_inoutno.Text + "' where ms_sncode = :v_barcode and ms_makecode = :v_makecode and ms_outno is null", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
                             dh.BatchInsert("update makeserial set ms_outno='" + pi_inoutno.Text + "' where ms_sncode = :v_barcode and ms_makecode = :v_makecode and ms_outno is null", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "栈板" + input.Text + "出货备货", "栈板" + input.Text + "出货备货成功", "", input.Text);
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "栈板" + input.Text + "出货备货", "栈板" + input.Text + "出货备货成功", input.Text,"");
                         }
                         }
                         else if (bigboxBtn.Checked)
                         else if (bigboxBtn.Checked)
                         {
                         {
@@ -386,7 +386,7 @@ namespace UAS_MES.Warehouse
                                 v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
                                 v_makecode.Add(datatable.Rows[i]["v_makecode"].ToString());
                             }
                             }
                             dh.BatchInsert("update makeserial set ms_outno='" + pi_inoutno.Text + "' where ms_sncode = :v_barcode and ms_makecode = :v_makecode and ms_outno is null", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
                             dh.BatchInsert("update makeserial set ms_outno='" + pi_inoutno.Text + "' where ms_sncode = :v_barcode and ms_makecode = :v_makecode and ms_outno is null", new string[] { "v_barcode", "v_makecode" }, v_barcode.ToArray(), v_makecode.ToArray());
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "箱号" + input.Text + "出货备货", "箱号" + input.Text + "出货备货成功", "", input.Text);
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "箱号" + input.Text + "出货备货", "箱号" + input.Text + "出货备货成功", input.Text,"");
                         }
                         }
                         else if (serBtn.Checked)
                         else if (serBtn.Checked)
                         {
                         {
@@ -577,7 +577,7 @@ namespace UAS_MES.Warehouse
                                 dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='PALLET' and pim_inorout='OUT'  AND pim_class='出货'", "delete");
                                 dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='PALLET' and pim_inorout='OUT'  AND pim_class='出货'", "delete");
                                 dh.UpdateByCondition("package", "pa_outno=''", "pa_outboxcode='" + input.Text + "'");
                                 dh.UpdateByCondition("package", "pa_outno=''", "pa_outboxcode='" + input.Text + "'");
                                 OperateResult.AppendText("栈板号" + input.Text + "取消备货成功\n", Color.Black, input);
                                 OperateResult.AppendText("栈板号" + input.Text + "取消备货成功\n", Color.Black, input);
-                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "栈板" + input.Text + "取消出货备货", "栈板" + input.Text + "取消出货备货成功", "", input.Text);
+                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "栈板" + input.Text + "取消出货备货", "栈板" + input.Text + "取消出货备货成功", input.Text,"");
                             }
                             }
                             else
                             else
                             {
                             {
@@ -635,7 +635,7 @@ namespace UAS_MES.Warehouse
                                 dh.BatchInsert("update makeserial set ms_outno='' where ms_sncode = :pim_mac and ms_prodcode = :pim_prodcode and ms_outno = '" + pi_inoutno.Text + "'", new string[] { "pim_mac", "pim_prodcode" }, pim_mac.ToArray(), pim_prodcode.ToArray());
                                 dh.BatchInsert("update makeserial set ms_outno='' where ms_sncode = :pim_mac and ms_prodcode = :pim_prodcode and ms_outno = '" + pi_inoutno.Text + "'", new string[] { "pim_mac", "pim_prodcode" }, pim_mac.ToArray(), pim_prodcode.ToArray());
                                 dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='BOX' and pim_inorout='OUT'  AND pim_class='出货'", "delete");
                                 dh.ExecuteSql("delete from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode='" + input.Text + "' and pim_type='BOX' and pim_inorout='OUT'  AND pim_class='出货'", "delete");
                                 OperateResult.AppendText("箱号" + input.Text + "取消备货成功\n", Color.Black, input);
                                 OperateResult.AppendText("箱号" + input.Text + "取消备货成功\n", Color.Black, input);
-                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "箱号" + input.Text + "取消出货备货", "箱号" + input.Text + "取消出货备货成功", "", input.Text);
+                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "箱号" + input.Text + "取消出货备货", "箱号" + input.Text + "取消出货备货成功", input.Text, "");
                             }
                             }
                             else
                             else
                             {
                             {

+ 19 - 3
UAS_CustomerInterface/MesHelper.cs

@@ -68,12 +68,23 @@ namespace UAS.MES
                 oErrMessage = "SN不能为空";
                 oErrMessage = "SN不能为空";
                 return false;
                 return false;
             }
             }
+            string oMsid = "";
             oErrMessage = "";
             oErrMessage = "";
             string[] param = new string[] { "", iResCode, iSN, "", "", "", oErrMessage };
             string[] param = new string[] { "", iResCode, iSN, "", "", "", oErrMessage };
             string[] ParamName = new string[] { "v_i_macode", "v_i_sourcecode", "v_i_sncode", "v_i_usercode", "v_o_macode", "v_o_msid", "v_o_errmsg" };
             string[] ParamName = new string[] { "v_i_macode", "v_i_sourcecode", "v_i_sncode", "v_i_usercode", "v_o_macode", "v_o_msid", "v_o_errmsg" };
             CallProcedure("CS_CHECKSTEPSNANDMACODE", ParamName, ref param);
             CallProcedure("CS_CHECKSTEPSNANDMACODE", ParamName, ref param);
+            oMsid = param[5];
             oErrMessage = param[6];
             oErrMessage = param[6];
-            DataTable dt = (DataTable)ExecuteSql("select ms_status,ms_stepcode,ms_nextstepcode from makeserial where ms_id=(select max(ms_id) from makeserial where ms_sncode='" + iSN + "')", "select");
+            DataTable dt = null;
+            if (oMsid == "" || oMsid == null || oMsid == "null")
+            {
+                sql.Clear();
+                sql.Append("select max(ms_id) from makeserial  where ms_sncode in (select '" + iSN + "' from dual union select sn from makesnrelation where ");
+                sql.Append(" beforesn = '" + iSN + "' and sn <> ' ' union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' ')");
+                dt = (DataTable)ExecuteSql(sql.ToString(), "select");
+                oMsid = dt.Rows[0][0].ToString();
+            }
+            dt = (DataTable)ExecuteSql("select ms_status,ms_stepcode,ms_nextstepcode from makeserial where ms_id='" + oMsid + "'","select");
             string ms_status = "";
             string ms_status = "";
             string ms_stepcode = "";
             string ms_stepcode = "";
             string ms_nextstepcode = "";
             string ms_nextstepcode = "";
@@ -84,6 +95,11 @@ namespace UAS.MES
                 ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
                 ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
             }
             }
             string stepcode = GetStepCodeBySource(iResCode);
             string stepcode = GetStepCodeBySource(iResCode);
+            if (ms_nextstepcode != "" && ms_nextstepcode != stepcode)
+            {
+                oErrMessage = "序列号下一工序" + ms_nextstepcode + ",前岗位资源不允许采集";
+                return false;
+            }
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null" || (ms_status == "3" && stepcode == ms_stepcode))
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null" || (ms_status == "3" && stepcode == ms_stepcode))
             {
             {
                 if (ms_status == "3")
                 if (ms_status == "3")
@@ -309,8 +325,8 @@ namespace UAS.MES
             }
             }
             oErrMessage = "";
             oErrMessage = "";
             sql.Clear();
             sql.Clear();
-            sql.Append("select max(ms_id) from makeserial where ms_sncode in (select '" + iSN + "' from dual union select ");
-            sql.Append("beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' ')");
+            sql.Append("select max(ms_id) from makeserial  where ms_sncode in (select '" + iSN + "' from dual union select sn from makesnrelation where ");
+            sql.Append(" beforesn = '" + iSN + "' and sn <> ' ' union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' ')");
             DataTable dt = (DataTable)ExecuteSql(sql.ToString(), "select");
             DataTable dt = (DataTable)ExecuteSql(sql.ToString(), "select");
             string ms_id = dt.Rows[0][0].ToString();
             string ms_id = dt.Rows[0][0].ToString();
             oMoCode = getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
             oMoCode = getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();