callm пре 1 недеља
родитељ
комит
8c9b048237
1 измењених фајлова са 13 додато и 13 уклоњено
  1. 13 13
      UAS_MES_YDCY/FunctionCode/Warehouse/Warehouse_FinishedProductOutSumNEW.cs

+ 13 - 13
UAS_MES_YDCY/FunctionCode/Warehouse/Warehouse_FinishedProductOutSumNEW.cs

@@ -441,8 +441,7 @@ namespace UAS_MES_NEW.Warehouse
                                 return;
                             }
                             RefreshWeight(pa_prodcode, input.Text);
-                            if (!checkinsertprodiomac("栈板号", input.Text))
-                                return;
+                    
                             //更新箱号对应的出货单号
                             dh.UpdateByCondition("package", "pa_outno = '" + pi_inoutno.Text + "'", "pa_outboxcode = '" + input.Text + "'");
                             //.UpdateByCondition("makeserial", "ms_outno='" + pi_inoutno.Text + "'", "ms_id in (select max(ms_id)  from makeserial where ms_sncode in (select v_barcode from MES_PACKAGE_VIEW where v_outboxcode = '" + input.Text + "') and ms_outno is null GROUP BY ms_sncode)");
@@ -454,8 +453,9 @@ namespace UAS_MES_NEW.Warehouse
                             List<string> pd_custprod = new List<string>();
                             DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode,ms_prodcode from MES_PACKAGE_VIEW  left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode = '" + input.Text + "'", "select");
 
-                            DataTable Cust = (DataTable)dh.ExecuteSql("select pd_outqty-nvl(pim_outqty,0)pd_outqty,pd_custprod,pd_custpodetno,PD_CUSTPO from  prodiodetail left join prodinout on pd_piid=pi_id left join (select pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO,count(1)pim_outqty from prodiomac where  pim_inoutno='" + pi_inoutno.Text + "' group by pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO)on pim_inoutno=pi_inoutno and PIM_CUSTPO=PD_CUSTPO and PIM_CUSTDETNO=pd_custpodetno where pi_inoutno='" + pi_inoutno.Text + "' and pd_prodcode='" + datatable.Rows[0]["ms_prodcode"].ToString() + "'  and pd_outqty-nvl(pim_outqty,0)>0 order by pd_pdno", "select");
-
+                            DataTable Cust = (DataTable)dh.ExecuteSql("select pd_outqty-nvl(pim_outqty,0)pd_outqty,pd_custprod,pd_custpodetno,PD_CUSTPO from  prodiodetail left join prodinout on pd_piid=pi_id left join (select pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO,count(1)pim_outqty from prodiomac where  pim_inoutno='" + pi_inoutno.Text + "' group by pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO)on pim_inoutno=pi_inoutno and PIM_CUSTPO=PD_CUSTPO and PIM_CUSTDETNO=pd_custpodetno where pi_inoutno='" + pi_inoutno.Text + "' and pd_custprod='" + dtms.Rows[0]["ma_custprodcode"] + "'  and pd_outqty-nvl(pim_outqty,0)>0 order by pd_pdno", "select");
+                            if (!checkinsertprodiomac("栈板号", input.Text))
+                                return;
                             List<int> custQtys = new List<int>();
                             List<string> custDetNos = new List<string>();
                             List<string> custPOs = new List<string>();
@@ -664,8 +664,7 @@ namespace UAS_MES_NEW.Warehouse
                                     dh.ExecuteSql("update package set pa_mothercode='" + pa_outboxcode.Text + "' where pa_outboxcode='" + input.Text + "'", "update");
                                 }
                                 RefreshWeight(pa_prodcode, input.Text);
-                                if (!checkinsertprodiomac("栈板号", pa_outboxcode.Text))
-                                    return;
+                              
                                 //更新箱号对应的出货单号
                                 //dh.UpdateByCondition("package", "pa_outno = '" + pi_inoutno.Text + "'", "pa_outboxcode = '" + input.Text + "'");
                                 List<string> v_barcode = new List<string>();
@@ -676,8 +675,9 @@ namespace UAS_MES_NEW.Warehouse
                                 List<string> pd_custprod = new List<string>();
                                 DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode,ms_prodcode from MES_PACKAGE_VIEW  left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode = '" + input.Text + "'", "select");
 
-                                DataTable Cust = (DataTable)dh.ExecuteSql("select pd_outqty-nvl(pim_outqty,0)pd_outqty,pd_custprod,pd_custpodetno,PD_CUSTPO from  prodiodetail left join prodinout on pd_piid=pi_id left join (select pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO,count(1)pim_outqty from prodiomac where  pim_inoutno='" + pi_inoutno.Text + "' group by pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO)on pim_inoutno=pi_inoutno and PIM_CUSTPO=PD_CUSTPO and PIM_CUSTDETNO=pd_custpodetno where pi_inoutno='" + pi_inoutno.Text + "' and pd_prodcode='" + datatable.Rows[0]["ms_prodcode"].ToString() + "'  and pd_outqty-nvl(pim_outqty,0)>0 order by pd_pdno", "select");
-
+                                DataTable Cust = (DataTable)dh.ExecuteSql("select pd_outqty-nvl(pim_outqty,0)pd_outqty,pd_custprod,pd_custpodetno,PD_CUSTPO from  prodiodetail left join prodinout on pd_piid=pi_id left join (select pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO,count(1)pim_outqty from prodiomac where  pim_inoutno='" + pi_inoutno.Text + "' group by pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO)on pim_inoutno=pi_inoutno and PIM_CUSTPO=PD_CUSTPO and PIM_CUSTDETNO=pd_custpodetno where pi_inoutno='" + pi_inoutno.Text + "' and pd_custprod='" + dtms.Rows[0]["ma_custprodcode"] + "'   and pd_outqty-nvl(pim_outqty,0)>0 order by pd_pdno", "select");
+                                if (!checkinsertprodiomac("栈板号", pa_outboxcode.Text))
+                                    return;
                                 List<int> custQtys = new List<int>();
                                 List<string> custDetNos = new List<string>();
                                 List<string> custPOs = new List<string>();
@@ -750,8 +750,7 @@ namespace UAS_MES_NEW.Warehouse
                                     dh.ExecuteSql("update package set pa_mothercode='" + pa_outboxcode.Text + "' where pa_outboxcode='" + input.Text + "'", "update");
                                 }
                                 RefreshWeight(pa_prodcode, input.Text);
-                                if (!checkinsertprodiomac("箱号", input.Text))
-                                    return;
+                              
                                 //更新箱号对应的出货单号
                                 dh.UpdateByCondition("package", "pa_outno = '" + pi_inoutno.Text + "'", "pa_outboxcode = '" + input.Text + "'");
                                 List<string> v_barcode = new List<string>();
@@ -762,8 +761,9 @@ namespace UAS_MES_NEW.Warehouse
                                 List<string> pd_custprod = new List<string>();
                                 DataTable datatable = (DataTable)dh.ExecuteSql("select v_makecode,v_barcode,ms_prodcode from MES_PACKAGE_VIEW  left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode = '" + input.Text + "'", "select");
 
-                                DataTable Cust = (DataTable)dh.ExecuteSql("select pd_outqty-nvl(pim_outqty,0)pd_outqty,pd_custprod,pd_custpodetno,PD_CUSTPO from  prodiodetail left join prodinout on pd_piid=pi_id left join (select pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO,count(1)pim_outqty from prodiomac where  pim_inoutno='" + pi_inoutno.Text+ "' group by pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO)on pim_inoutno=pi_inoutno and PIM_CUSTPO=PD_CUSTPO and PIM_CUSTDETNO=pd_custpodetno where pi_inoutno='"+pi_inoutno.Text+"' and pd_prodcode='"+ datatable.Rows[0]["ms_prodcode"].ToString() + "'  and pd_outqty-nvl(pim_outqty,0)>0 order by pd_pdno", "select");
-
+                                DataTable Cust = (DataTable)dh.ExecuteSql("select pd_outqty-nvl(pim_outqty,0)pd_outqty,pd_custprod,pd_custpodetno,PD_CUSTPO from  prodiodetail left join prodinout on pd_piid=pi_id left join (select pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO,count(1)pim_outqty from prodiomac where  pim_inoutno='" + pi_inoutno.Text+ "' group by pim_inoutno,PIM_CUSTPO, PIM_CUSTDETNO)on pim_inoutno=pi_inoutno and PIM_CUSTPO=PD_CUSTPO and PIM_CUSTDETNO=pd_custpodetno where pi_inoutno='"+pi_inoutno.Text+ "' and pd_custprod='" + dtms.Rows[0]["ma_custprodcode"] + "'  and pd_outqty-nvl(pim_outqty,0)>0 order by pd_pdno", "select");
+                                if (!checkinsertprodiomac("箱号", input.Text))
+                                    return;
                                 List<int> custQtys = new List<int>();
                                 List<string> custDetNos = new List<string>();
                                 List<string> custPOs = new List<string>();
@@ -980,7 +980,7 @@ namespace UAS_MES_NEW.Warehouse
             sql.Clear();
             sql.Append("insert into prodiomac(pim_id,pim_inoutno,pim_piid,pim_prodcode,pim_mac,pim_indate,pim_inman,pim_type,pim_outboxcode,pim_inorout,pim_class,pim_custpo,pim_custdetno,pim_pdid,pim_custprodcode)");
             sql.Append("select prodiomac_seq.nextval,'" + pi_inoutno.Text + "','" + pi_id.Text + "',ms_prodcode,ms_sncode,sysdate,'" + User.UserCode + "','" + pib_type + "','" + iBox + "','OUT','出货','" + custpo + "','" + custpodetno + "','" + PDID + "',ma_custprodcode " +
-                " from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode left join make on ma_code=ms_makecode where v_outboxcode='" + iBox + "' and  (v_prodcode,ms_sncode) not in (select PIM_PRODCODE, PIM_MAC from prodiomac)");
+                " from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode left join make on ma_code=ms_makecode where v_outboxcode='" + iBox + "' and   not exists (select 1 from prodiomac where PIM_PRODCODE = ms_prodcode and PIM_MAC = ms_sncode)");
             dh.ExecuteSql(sql.GetString(), "insert");
         }