瀏覽代碼

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

Hcsy 8 年之前
父節點
當前提交
0520f7f7eb

+ 47 - 22
UAS-MES/FunctionCode/Make/Make_GetReMakeSN.cs

@@ -123,7 +123,7 @@ namespace UAS_MES.Make
                             {
                                 //序列号信息
                                 sql.Clear();
-                                sql.Append("select ms_beforesn,ms_makecode,ms_firstsn,ms_outboxcode,ms_nextmacode,ms_prodcode,ms_salecode,");
+                                sql.Append("select ms_beforesn,ms_status,ms_makecode,ms_firstsn,ms_outboxcode,ms_nextmacode,ms_prodcode,ms_salecode,");
                                 sql.Append("MS_IMEI1,MS_MAC,MS_NETCODE,MS_MEID,ms_imei2,ms_imei3,ms_othid1,ms_othid2,ms_othid3");
                                 sql.Append(",MS_OTHCODE3,MS_OTHCODE2,MS_OTHCODE1,ms_bt from makeserial where ms_id='" + Msid + "'");
                                 DataTable SnInf = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -131,6 +131,8 @@ namespace UAS_MES.Make
                                 string ms_salecode = SnInf.Rows[0]["ms_salecode"].ToString();
                                 string ms_beforesn = SnInf.Rows[0]["ms_beforesn"].ToString();
                                 string ms_makecode = SnInf.Rows[0]["ms_makecode"].ToString();
+                                string ms_status = SnInf.Rows[0]["ms_status"].ToString();
+                                string ms_outboxcode = SnInf.Rows[0]["ms_outboxcode"].ToString();
                                 //判断序列号是否已经被使用
                                 if (SnInf.Rows[0]["ms_nextmacode"].ToString() != "")
                                 {
@@ -140,11 +142,14 @@ namespace UAS_MES.Make
                                 //工单信息
                                 sql.Clear();
                                 sql.Append("select ma_salecode,ma_prodcode,ma_craftname,ma_inqty,ma_craftcode,ma_qty,nvl(ma_inqty,0) ma_inqty,");
-                                sql.Append("nvl(ma_scrapqty,0)ma_scrapqty,ma_id,nvl(ma_unlimitin,0) ma_unlimitin,ma_wccode from make ");
-                                sql.Append("where ma_code='" + ma_code.Text + "'and ma_kind='返工' and  ma_statuscode='STARTED'");
+                                sql.Append("nvl(ma_scrapqty,0)ma_scrapqty,ma_id,nvl(ma_unlimitin,0) ma_unlimitin,ma_wccode,NVL(re_autodecom,0)");
+                                sql.Append("re_autodecom,re_code from make left join rework on ma_screcode=re_code where ");
+                                sql.Append("ma_code='" + ma_code.Text + "'and ma_kind='返工' and  ma_statuscode='STARTED'");
                                 DataTable MaInf = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                 string ma_prodcode = MaInf.Rows[0]["ma_prodcode"].ToString();
                                 string ma_salecode = MaInf.Rows[0]["ma_salecode"].ToString();
+                                string re_autodecom = MaInf.Rows[0]["re_autodecom"].ToString();
+                                string re_code = MaInf.Rows[0]["re_code"].ToString();
                                 int ma_unlimitin = int.Parse(MaInf.Rows[0]["ma_unlimitin"].ToString());
                                 int ma_inqty = int.Parse(MaInf.Rows[0]["ma_inqty"].ToString());
                                 int ma_scrapqty = int.Parse(MaInf.Rows[0]["ma_scrapqty"].ToString());
@@ -165,18 +170,18 @@ namespace UAS_MES.Make
                                     return;
                                 }
                                 string Sn = sn_code.Text;
-                                if (ReWorkAsRelateTSN.Checked)
-                                {
-                                    if (ms_beforesn != "")
-                                    {
-                                        Sn = ms_beforesn;
-                                    }
-                                    else
-                                    {
-                                        OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在TSN\n", Color.Red, sn_code);
-                                        return;
-                                    }
-                                }
+                                //if (ReWorkAsRelateTSN.Checked)
+                                //{
+                                //    if (ms_beforesn != "")
+                                //    {
+                                //        Sn = ms_beforesn;
+                                //    }
+                                //    else
+                                //    {
+                                //        OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在TSN\n", Color.Red, sn_code);
+                                //        return;
+                                //    }
+                                //}
                                 string netcode = "";
                                 string imeid = "";
                                 string imei1 = "";
@@ -218,10 +223,11 @@ namespace UAS_MES.Make
                                     workcenter = MaInf.Rows[0]["ma_wccode"].ToString();
                                 //工单合同为空的时候取序列号合同,更新合同回工单
                                 string salecode = MaInf.Rows[0]["ma_salecode"].ToString();
+                                List<string> SQLS = new List<string>();
                                 if (salecode == "")
                                 {
                                     salecode = SnInf.Rows[0]["ms_salecode"].ToString();
-                                    dh.ExecuteSql("update make set ma_salecode='" + salecode + "' where ma_id='" + ma_id.Text + "'", "update");
+                                    SQLS.Add("update make set ma_salecode='" + salecode + "' where ma_id='" + ma_id.Text + "'");
                                 }
                                 sql.Clear();
                                 sql.Append("insert into MakeSerial(ms_id,ms_code,ms_sncode,ms_prodcode,ms_indate,ms_wccode");
@@ -230,16 +236,35 @@ namespace UAS_MES.Make
                                 sql.Append("ms_othcode3,ms_netcode,ms_imei1,ms_imei2,ms_imei3,ms_meid,ms_othid1,ms_othid2,ms_othid3)");
                                 sql.Append("values(MakeSerial_seq.nextval,'" + Sn + "','" + Sn + "','" + pr_code.Text + "',");
                                 sql.Append("sysdate,'" + workcenter + "','" + craftcode + "','" + craftname + "','" + User.CurrentStepCode + "',");
-                                sql.Append("1,'" + ma_code.Text + "','" + User.UserLineCode + "','" + User.UserSourceCode + "','" + ma_id.Text + "',");
+                                sql.Append("" + (ms_status != "3" ? "0" : "3") + ",'" + ma_code.Text + "','" + User.UserLineCode + "','" + User.UserSourceCode + "','" + ma_id.Text + "',");
                                 sql.Append("'" + firstsn + "','" + salecode + "','" + mac + "','" + bt + "','" + othcode1 + "','" + othcode2 + "','" + othcode3 + "',");
                                 sql.Append("'" + netcode + "','" + imei1 + "','" + imei2 + "','" + imei3 + "','" + imeid + "','" + othid1 + "','" + othid2 + "','" + othid3 + "')");
-                                dh.ExecuteSql(sql.GetString(), "insert");
-                                dh.ExecuteSql("update make set ma_inqty=nvl(ma_inqty,0)+1 where ma_id='" + ma_id.Text + "'", "update");
-                                dh.ExecuteSql("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_id='" + Msid + "'", "update");
-                                if (ReWorkAsRelateTSN.Checked)
+                                SQLS.Add(sql.GetString());
+                                SQLS.Add("update make set ma_inqty=nvl(ma_inqty,0)+1 where ma_id='" + ma_id.Text + "'");
+                                SQLS.Add("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_id='" + Msid + "'");
+                                if (ms_outboxcode != "")
+                                {
+                                    //更新箱号失效
+                                    sql.Clear();
+                                    sql.Append("update package set pa_status=-1 where pa_outboxcode='" + ms_outboxcode + "' and pa_status<>-1");
+                                    SQLS.Add(sql.GetString());
+                                }
+                                sql.Clear();
+                                sql.Append("update makebad set mb_makecode='" + ms_makecode + "' where mb_sncode ='" + sn_code.Text + "' and mb_status=0");
+                                SQLS.Add(sql.GetString());
+                                if (re_autodecom != "0")
                                 {
-                                    dh.ExecuteSql("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_sncode='" + ms_beforesn + "' and ms_nextmacode='" + ms_makecode + "'", "update");
+                                    sql.Clear();
+                                    sql.Append("update craftmaterial set cm_status=-1,cm_dropcode='" + re_code + "',cm_dropman='" + User.UserCode + "',cm_dropdate=sysdate where ");
+                                    sql.Append("cm_firstsn='" + firstsn + "' and  nvl(cm_status,0)=0 and exists (select 1 from makesndecompose ");
+                                    sql.Append("where msd_recode='" + re_code + "' and msd_fsoncode=cm_fsoncode and msd_stepcode=cm_stepcode)");
+                                    SQLS.Add(sql.GetString());
                                 }
+                                dh.ExecuteSQLTran(SQLS.ToArray());
+                                //if (ReWorkAsRelateTSN.Checked)
+                                //{
+                                //    dh.ExecuteSql("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_sncode='" + ms_beforesn + "' and ms_nextmacode='" + ms_makecode + "'", "update");
+                                //}
                                 OperateResult.AppendText(">>序列号" + sn_code.Text + "归属工单" + ma_code.Text + "成功。\n", Color.Green);
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "返工信息采集", "序列号归属成功", sn_code.Text, "");
                                 getsnqty.Text = dh.getFieldDataByCondition("makeserial ", "count(1)", "ms_makecode='" + ma_code.Text + "'").ToString();

+ 2 - 2
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -326,7 +326,7 @@ namespace UAS_MES.Make
 
         private void Packing_Click(object sender, EventArgs e)
         {
-            if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_status<>1"))
+            if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_status=0"))
             {
                 dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                 pa_status.Text = "1";
@@ -339,7 +339,7 @@ namespace UAS_MES.Make
 
         private void SendCheck_Click(object sender, EventArgs e)
         {
-            if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() != "0")
+            if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "1")
             {
                 DataTable dt = (DataTable)dh.ExecuteSql("select wm_concat(pa_outboxcode) pa_outboxcode from package where pa_checkno='" + ob_checkno.Text + "' and pa_status=0 ", "select");
                 if (dt.Rows[0][0].ToString() != "")

+ 2 - 4
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -410,7 +410,7 @@ namespace UAS_MES.Make
 
         private void Packing_Click(object sender, EventArgs e)
         {
-            if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_status<>1"))
+            if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_status=0"))
             {
                 dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                 pa_status.Text = "1";
@@ -422,7 +422,7 @@ namespace UAS_MES.Make
 
         private void SendCheck_Click(object sender, EventArgs e)
         {
-            if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() != "0")
+            if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "1")
             {
                 DataTable dt = (DataTable)dh.ExecuteSql("select wm_concat(pa_outboxcode) pa_outboxcode from package where pa_checkno='" + ob_checkno.Text + "' and pa_status=0 ", "select");
                 if (dt.Rows[0][0].ToString() != "")
@@ -444,8 +444,6 @@ namespace UAS_MES.Make
                 ob_checkno.Text = "";
             }
             else OperateResult.AppendText(">>必须封箱才能送检\n", Color.Red);
-
-
         }
 
         bool AutoCut;

+ 2 - 2
UAS-MES/FunctionCode/Make/Make_SpecialCartonPack.cs

@@ -335,7 +335,7 @@ namespace UAS_MES.Make
 
         private void Packing_Click(object sender, EventArgs e)
         {
-            if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_status<>1"))
+            if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_status=0"))
             {
                 dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                 pa_status.Text = "1";
@@ -346,7 +346,7 @@ namespace UAS_MES.Make
 
         private void SendCheck_Click(object sender, EventArgs e)
         {
-            if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() != "0")
+            if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "1")
             {
                 DataTable dt = (DataTable)dh.ExecuteSql("select wm_concat(pa_outboxcode) pa_outboxcode from package where pa_checkno='" + ob_checkno.Text + "' and pa_status=0 ", "select");
                 if (dt.Rows[0][0].ToString() != "")