فهرست منبع

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

Hcsy 7 سال پیش
والد
کامیت
c25da82461

+ 0 - 1
PLCDataReader/Main.Designer.cs

@@ -1702,7 +1702,6 @@ namespace UAS_PLCDataReader
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "设备监控管理平台";
             this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
-            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing);
             this.Load += new System.EventHandler(this.Main_Load);
             ((System.ComponentModel.ISupportInitialize)(this.RibbonNav)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.MainTabControl)).EndInit();

+ 48 - 48
PLCDataReader/Main.cs

@@ -167,16 +167,6 @@ namespace UAS_PLCDataReader
 
             Ptime = new Dictionary<int, PollingTimer>();
         }
-        /// <summary>
-        /// 关闭前将所有设备离线,状态更新为离线
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void Main_FormClosing(object sender, FormClosingEventArgs e)
-        {
-            dh.ExecuteSql("update devicepollingconfig set dpc_status='Stop' where dpc_status='Running'", "update");
-            dh.ExecuteSql("update devicepollinglog set dpg_status='Stop' where dpg_status='Running'", "update");
-        }
         #endregion
 
         #region 设备列表界面
@@ -414,17 +404,13 @@ namespace UAS_PLCDataReader
                     sql.Append("insert into DEVICEPOLLINGLOG(dpg_id,dpg_decode,dpg_starttime,dpg_interval)values");
                     sql.Append("(DEVICEPOLLINGLOG_seq.nextval,'" + pl.DeviceCode + "',sysdate,'" + pl.Interval + "')");
                     dh.ExecuteSql(sql.ToString(), "insert");
-                    sql.Clear();
-                    sql.Append("MERGE INTO DeviceRunstatus alias1 USING (select '" + pl.DeviceCode + "' dr_decode from  dual) alias2 ");
-                    sql.Append("ON (alias1.dr_decode=alias2.dr_decode) WHEN MATCHED THEN  UPDATE  SET dr_startdate =sysdate ");
-                    sql.Append("WHEN NOT MATCHED THEN INSERT (Dr_id,dr_decode,dr_dename,Dr_runstatus,dr_startdate) VALUES (DeviceRunstatus_seq.nextval,");
-                    sql.Append("'" + pl.DeviceCode + "','" + pl.DeviceName + "','running',sysdate)");
-                    dh.ExecuteSql(sql.ToString(), "update");
+                    LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, "running");
                     pt.AddTask(RunTask, pl);
                     //添加到状态为运行的行
                     PollSettingPaintRowIndex.Add(i);
                     GridPollingSetting.Focus();
                 }
+                else LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, "stopped");
             }
         }
 
@@ -499,7 +485,7 @@ namespace UAS_PLCDataReader
                 }
                 else
                 {
-                    ModBusTCPClient modclient = new ModBusTCPClient(DNC.Rows[0]["dnc_ip"].ToString(), int.Parse(DNC.Rows[0]["dnc_port"].ToString()));
+                    ModBusTCPClient modclient = new ModBusTCPClient(DNC.Rows[0]["dnc_ip"].ToString(), int.Parse(DNC.Rows[0]["dnc_port"].ToString()), pl.DeviceCode, pl.DeviceName);
                     client.Add(DpcID, modclient);
                 }
                 //如果不包含该项数据则在键值对中添加
@@ -665,7 +651,7 @@ namespace UAS_PLCDataReader
             if (PageDeviceStatus.PageVisible)
             {
                 DeviceStatusQuerySQL.Clear();
-                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG on dpc_decode=de_code order by de_code");
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dr_runstatus from device left join devicerunstatus on dr_decode=de_code order by de_code");
                 PaintDeviceStatusControl(DeviceStatusQuerySQL.ToString());
                 //填充筛选条件,车间和线体
                 DataTable dt = (DataTable)dh.ExecuteSql("select wc_code,wc_name from workcenter", "select");
@@ -678,13 +664,13 @@ namespace UAS_PLCDataReader
             DeviceStatusQuerySQL.Clear();
             if (CheckEditDeviceStatusEnable.Checked)
             {
-                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG ");
-                DeviceStatusQuerySQL.Append("on dpc_decode=de_code where nvl(dpc_enable,0)<>0 order by de_code");
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dr_runstatus from device left join devicerunstatus ");
+                DeviceStatusQuerySQL.Append("on dr_decode=de_code where nvl(dpc_enable,0)<>0 order by de_code");
             }
             else
             {
-                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG ");
-                DeviceStatusQuerySQL.Append("on dpc_decode=de_code order by de_code");
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dr_runstatus from device left join devicerunstatus ");
+                DeviceStatusQuerySQL.Append("on dr_decode=de_code order by de_code");
             }
             PaintDeviceStatusControl(DeviceStatusQuerySQL.ToString());
         }
@@ -695,13 +681,13 @@ namespace UAS_PLCDataReader
             string WC = BaseUtil.GetComboxEditValue(ComboxDeviceStatusWC);
             if (CheckEditDeviceStatusEnable.Checked)
             {
-                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG ");
-                DeviceStatusQuerySQL.Append("on dpc_decode=de_code where nvl(dpc_enable,0)<>0 and de_wccode='" + WC + "' order by de_code");
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dr_runstatus from device left join devicerunstatus ");
+                DeviceStatusQuerySQL.Append("on dr_decode=de_code where nvl(dpc_enable,0)<>0 and de_wccode='" + WC + "' order by de_code");
             }
             else
             {
-                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG ");
-                DeviceStatusQuerySQL.Append("on dpc_decode=de_code where de_wccode='" + WC + "' order by de_code");
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dr_runstatus from device left join devicerunstatus ");
+                DeviceStatusQuerySQL.Append("on dr_decode=de_code where de_wccode='" + WC + "' order by de_code");
             }
             PaintDeviceStatusControl(DeviceStatusQuerySQL.ToString());
             sql.Clear();
@@ -720,8 +706,8 @@ namespace UAS_PLCDataReader
             string LC = BaseUtil.GetComboxEditValue(ComboxDeviceStatusLC);
             if (CheckEditDeviceStatusEnable.Checked)
             {
-                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join ");
-                DeviceStatusQuerySQL.Append("DEVICEPOLLINGCONFIG on dpc_decode=de_code where nvl(dpc_enable,0)<>0");
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dr_runstatus from device left join ");
+                DeviceStatusQuerySQL.Append("devicerunstatus on dr_decode=de_code ");
                 if (WC != "全部")
                     DeviceStatusQuerySQL.Append(" and de_wccode='" + WC + "' ");
                 if (LC != "全部")
@@ -730,8 +716,8 @@ namespace UAS_PLCDataReader
             }
             else
             {
-                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join ");
-                DeviceStatusQuerySQL.Append("DEVICEPOLLINGCONFIG on dpc_decode=de_code ");
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dr_runstatus from device left join ");
+                DeviceStatusQuerySQL.Append("devicerunstatus on dr_decode=de_code ");
                 if (WC != "全部" && LC != "全部")
                     DeviceStatusQuerySQL.Append(" where de_wccode='" + WC + "' and de_linecode='" + LC + "' ");
                 if (WC == "全部" && LC != "全部")
@@ -781,16 +767,23 @@ namespace UAS_PLCDataReader
                         pic.Picedit.MouseHover += Pic_MouseHover;
                         pic.Picedit.Properties.SizeMode = PictureSizeMode.Squeeze;
                         //如果该设备已启动
-                        if (ReturnData.ContainsKey(dt.Rows[j * CountPerRow + i]["de_code"].ToString()))
+                        switch (dt.Rows[j * CountPerRow + i]["dr_runstatus"].ToString())
                         {
-                            if (ReturnData[dt.Rows[j * CountPerRow + i]["de_code"].ToString()].RunStatus == "Running")
-                            {
-                                pic.Picedit.Image = Properties.Resources.net_connected;
-                            }
-                        }
-                        else
-                        {
-                            pic.Picedit.Image = Properties.Resources.network_offline;
+                            case "running":
+                                pic.Picedit.Image = Properties.Resources.running;
+                                break;
+                            case "disconnect":
+                                pic.Picedit.Image = Properties.Resources.disconnect;
+                                break;
+                            case "stopped":
+                                pic.Picedit.Image = Properties.Resources.stopped;
+                                break;
+                            case "noanswer":
+                                pic.Picedit.Image = Properties.Resources.noanswer;
+                                break;
+                            default:
+                                pic.Picedit.Image = Properties.Resources.stopped;
+                                break;
                         }
                         pic.Text = dt.Rows[j * CountPerRow + i]["de_code"].ToString();
                         pic.Picedit.BorderStyle = BorderStyles.HotFlat;
@@ -850,16 +843,23 @@ namespace UAS_PLCDataReader
                 }
                 for (int i = 0; i < (j == RowCount - 1 ? LastRowCount : CountPerRow); i++)
                 {
-                    if (ReturnData.ContainsKey(dt.Rows[j * CountPerRow + i]["de_code"].ToString()))
-                    {
-                        if (ReturnData[dt.Rows[j * CountPerRow + i]["de_code"].ToString()].RunStatus == "Running")
-                        {
-                            (PanelDeviceStatus.Controls[dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j] as PictureEditWithText).Picedit.Image = Properties.Resources.net_connected;
-                        }
-                    }
-                    else
+                    switch (dt.Rows[j * CountPerRow + i]["dr_runstatus"].ToString())
                     {
-                        (PanelDeviceStatus.Controls[dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j] as PictureEditWithText).Picedit.Image = Properties.Resources.network_offline;
+                        case "running":
+                            (PanelDeviceStatus.Controls[dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j] as PictureEditWithText).Picedit.Image = Properties.Resources.running;
+                            break;
+                        case "disconnect":
+                            (PanelDeviceStatus.Controls[dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j] as PictureEditWithText).Picedit.Image = Properties.Resources.disconnect;
+                            break;
+                        case "stopped":
+                            (PanelDeviceStatus.Controls[dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j] as PictureEditWithText).Picedit.Image = Properties.Resources.stopped;
+                            break;
+                        case "noanswer":
+                            (PanelDeviceStatus.Controls[dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j] as PictureEditWithText).Picedit.Image = Properties.Resources.noanswer;
+                            break;
+                        default:
+                            (PanelDeviceStatus.Controls[dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j] as PictureEditWithText).Picedit.Image = Properties.Resources.stopped;
+                            break;
                     }
                 }
             }

+ 50 - 0
PLCDataReader/Properties/Resources.Designer.cs

@@ -80,6 +80,16 @@ namespace UAS_PLCDataReader.Properties {
             }
         }
         
+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap computer_process_72px_501146_easyicon_net {
+            get {
+                object obj = ResourceManager.GetObject("computer_process_72px_501146_easyicon_net", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
@@ -90,6 +100,16 @@ namespace UAS_PLCDataReader.Properties {
             }
         }
         
+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap disconnect {
+            get {
+                object obj = ResourceManager.GetObject("disconnect", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
@@ -120,6 +140,16 @@ namespace UAS_PLCDataReader.Properties {
             }
         }
         
+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap noanswer {
+            get {
+                object obj = ResourceManager.GetObject("noanswer", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
@@ -130,6 +160,26 @@ namespace UAS_PLCDataReader.Properties {
             }
         }
         
+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap running {
+            get {
+                object obj = ResourceManager.GetObject("running", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap stopped {
+            get {
+                object obj = ResourceManager.GetObject("stopped", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>

+ 15 - 0
PLCDataReader/Properties/Resources.resx

@@ -145,4 +145,19 @@
   <data name="U_Letter_72px_1121581_easyicon_net" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Resources\U_Letter_72px_1121581_easyicon.net.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
+  <data name="computer_process_72px_501146_easyicon_net" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\computer_process_72px_501146_easyicon.net.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
+  <data name="disconnect" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\disconnect.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
+  <data name="noanswer" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\noanswer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
+  <data name="running" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\running.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
+  <data name="stopped" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\stopped.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
 </root>

+ 10 - 0
PLCDataReader/PublicMethod/LogicHandler.cs

@@ -80,5 +80,15 @@ namespace UAS_PLCDataReader.PublicMethod
             sql.Append("update DeviceRunstatus set dr_qty=:dr_inqty,dr_okqty=:dr_okqty,dr_TEMPERATURE=:dr_TEMPERATURE where dr_decode='" + Decode + "'");
             dh.ExecuteSql(sql.ToString(), "select", INQTY, OUTQTY, TEMPERATURE);
         }
+
+        public static void UpdateDeviceStatus(string iDecode, string iDename, string iDestatus)
+        {
+            sql.Clear();
+            sql.Append("MERGE INTO DeviceRunstatus alias1 USING (select '" + iDecode + "' dr_decode from  dual) alias2 ");
+            sql.Append("ON (alias1.dr_decode=alias2.dr_decode) WHEN MATCHED THEN  UPDATE  SET dr_startdate =sysdate,Dr_runstatus='" + iDestatus + "' ");
+            sql.Append("WHEN NOT MATCHED THEN INSERT (Dr_id,dr_decode,dr_dename,Dr_runstatus,dr_startdate) VALUES (DeviceRunstatus_seq.nextval,");
+            sql.Append("'" + iDecode + "','" + iDename + "','" + iDestatus + "',sysdate)");
+            dh.ExecuteSql(sql.ToString(), "update");
+        }
     }
 }

+ 12 - 3
PLCDataReader/PublicMethod/ModBusTCPClient.cs

@@ -88,8 +88,13 @@ namespace UAS_PLCDataReader.PublicMethod
 
         private string port;
 
-        public ModBusTCPClient(string IP, int Port)
+        string decode = "";
+        string dename = "";
+
+        public ModBusTCPClient(string IP, int Port,string Decode,string Dename)
         {
+            decode = Decode;
+            dename = Dename;
             socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
             serverFullAddr = new IPEndPoint(IPAddress.Parse(IP), Port);//设置IP,端口
             try
@@ -98,7 +103,7 @@ namespace UAS_PLCDataReader.PublicMethod
             }
             catch (Exception)
             {
-
+                LogicHandler.UpdateDeviceStatus(decode, dename,"disconnect");
             }
         }
 
@@ -119,16 +124,20 @@ namespace UAS_PLCDataReader.PublicMethod
                     arr[i] = (byte)Convert.ToInt32(Command.Substring(i * 2, 2), 16);
                 }
                 socket.Send(arr);
+
                 byte[] receive = new byte[1024 * 1024];
+                LogicHandler.UpdateDeviceStatus(decode, dename, "noanswer");
                 int length = socket.Receive(receive);
+                LogicHandler.UpdateDeviceStatus(decode, dename, "running");
                 if (!returnvalue.ContainsKey(socket.RemoteEndPoint.ToString()))
                 {
                     returnvalue.Add(socket.RemoteEndPoint.ToString(), BaseUtil.ByteToHexadecimalString(receive, length));
                 }
+              
             }
             catch (Exception e)
             {
-                Console.WriteLine(e.Message);
+                LogicHandler.UpdateDeviceStatus(decode, dename, "disconnect");
             }
         }
     }

BIN
PLCDataReader/Resources/computer_process_72px_501146_easyicon.net.png


BIN
PLCDataReader/Resources/disconnect.png


BIN
PLCDataReader/Resources/noanswer.png


BIN
PLCDataReader/Resources/running.png


BIN
PLCDataReader/Resources/stopped.png


+ 5 - 0
PLCDataReader/UAS_PLCDataReader.csproj

@@ -359,6 +359,11 @@
     <None Include="Resources\devicecontrol.png" />
     <None Include="Resources\close_24px_1069872_easyicon.net.png" />
     <None Include="Resources\check_16px_1137507_easyicon.net.png" />
+    <None Include="Resources\computer_process_72px_501146_easyicon.net.png" />
+    <None Include="Resources\noanswer.png" />
+    <None Include="Resources\disconnect.png" />
+    <None Include="Resources\stopped.png" />
+    <None Include="Resources\running.png" />
     <Content Include="Tool\DevExpress.Charts.Designer.v15.2.dll" />
     <Content Include="Tool\DevExpress.Data.v15.2.dll" />
     <Content Include="Tool\DevExpress.Printing.v15.2.Core.dll" />

+ 294 - 128
TestProject/DrawHelper.cs

@@ -1,136 +1,302 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+//create or replace PROCEDURE "CS_PACKCARTON"
+//-- =============================================
+//-- Author:    <XIAOST>
+//-- Create date: <2017-09-23>
+//-- Description:  <装卡通箱
+//--                1、 支持自动生成箱号,
+//--                2、 支持转入已存在箱号,
+//--                3、 标准装箱需要产品和箱号的包装规则一致 包含:按合同 SALE,按订单 MAKE ,按产品 PROD,混合 MIX
+//--                4、 特殊装箱,无需考虑装箱规则等限制
+//--               >
+//-- =============================================
+//(  /*
+//    参数:输入 -- SN号,箱号,是否自动生成,装箱类型,岗位资源,操作人编号
+//         输出  --箱号,异常信息
+//   */
+//    v_i_sncode in varchar2, --SN
+//    v_i_outboxcode in varchar2, --卡通箱号
+//    v_i_autonew in varchar2 default 'N', --默认否
+//    v_i_type    in varchar2 ,-- 装箱类型,标准或者特殊,默认标准
+//    v_i_sourcecode  in varchar2,  --岗位资源编号
+//    v_i_usercode  in varchar2,  --人员编号
+//    v_i_standardqty in number,  --标准容量
+//    v_i_inorout in varchar2,  ---装箱或取消装箱入或者出 IN, OUT
+//    v_o_outboxcode out varchar2,   --输出卡通箱号
+//    v_o_errmsg out varchar2      ---输入异常信息
+//) as   
+//    v_pr_packrule product.pr_packrule%type;  --产品包装规则
+//v_pr_outboxinnerqty  product.pr_outboxinnerqty%type;--装箱容量
+//v_pa_packtype        varchar2(20);  --卡通箱装箱类型
+//v_pa_standardqty     number;   ---标准容量
+//v_pa_currentqty      number; 
+//    v_pa_prodcode varchar2(50);
+//v_pa_makecode varchar2(50);
+//v_pa_salecode varchar2(50);
+//v_pa_downstatus number; --是否下地
+//v_pa_id              number;
+//    v_pa_status number;
+//v_pa_checkno varchar2(30);
+//v_pa_currentstep varchar2(60);
+//v_pa_mothercode varchar2(50);
+//v_pa_outno varchar2(50);
+//v_ob_status varchar2(20);
+//v_outboxcode varchar2(30);
 
-namespace TestProject
-{
-    class DrawHelper
-    {
-        #region RendererBackground 渲染背景图片,使背景图片不失真
+//v_ms_prodcode varchar2(50);
+//v_ms_makecode make.ma_code%type;
+//v_ms_id makeserial.ms_id%type;
+//v_ms_outboxcode varchar2(50);
+//v_ms_craftcode varchar2(50);
+//v_ms_salecode varchar2(50);
+//v_ms_downstatus number; --是否下地
 
-        /// <summary>
-        /// 渲染背景图片,使背景图片不失真
-        /// </summary>
-        /// <param name="g"></param>
-        /// <param name="rect"></param>
-        /// <param name="backgroundImage"></param>
-        /// <param name="method"></param>
-        public static void RendererBackground(Graphics g, Rectangle rect, Image backgroundImage, bool method)
-        {
-            if (!method)
-            {
-                g.DrawImage(backgroundImage, new Rectangle(rect.X + 0, rect.Y, 5, rect.Height), 0, 0, 5, backgroundImage.Height, GraphicsUnit.Pixel);
-                g.DrawImage(backgroundImage, new Rectangle(rect.X + 5, rect.Y, rect.Width - 10, rect.Height), 5, 0, backgroundImage.Width - 10, backgroundImage.Height, GraphicsUnit.Pixel);
-                g.DrawImage(backgroundImage, new Rectangle(rect.X + rect.Width - 5, rect.Y, 5, rect.Height), backgroundImage.Width - 5, 0, 5, backgroundImage.Height, GraphicsUnit.Pixel);
-            }
-            else
-            {
-                DrawHelper.RendererBackground(g, rect, 5, backgroundImage);
-            }
-        }
+//v_currentstep       varchar2(50);
+//v_linecode varchar2(50);
+//v_scstatuscode varchar2(50);
+//v_stepname varchar2(100);
+//v_wccode varchar2(30);
 
-        /// <summary>
-        /// 渲染背景图片,使背景图片不失真
-        /// </summary>
-        /// <param name="g"></param>
-        /// <param name="rect"></param>
-        /// <param name="cut"></param>
-        /// <param name="backgroundImage"></param>
-        public static void RendererBackground(Graphics g, Rectangle rect, int cut, Image backgroundImage)
-        {
-            //左上角
-            g.DrawImage(backgroundImage, new Rectangle(rect.X, rect.Y, cut, cut), 0, 0, cut, cut, GraphicsUnit.Pixel);
-            //上边
-            g.DrawImage(backgroundImage, new Rectangle(rect.X + cut, rect.Y, rect.Width - cut * 2, cut), cut, 0, backgroundImage.Width - cut * 2, cut, GraphicsUnit.Pixel);
-            //右上角
-            g.DrawImage(backgroundImage, new Rectangle(rect.X + rect.Width - cut, rect.Y, cut, cut), backgroundImage.Width - cut, 0, cut, cut, GraphicsUnit.Pixel);
-            //左边
-            g.DrawImage(backgroundImage, new Rectangle(rect.X, rect.Y + cut, cut, rect.Height - cut * 2), 0, cut, cut, backgroundImage.Height - cut * 2, GraphicsUnit.Pixel);
-            //左下角
-            g.DrawImage(backgroundImage, new Rectangle(rect.X, rect.Y + rect.Height - cut, cut, cut), 0, backgroundImage.Height - cut, cut, cut, GraphicsUnit.Pixel);
-            //右边
-            g.DrawImage(backgroundImage, new Rectangle(rect.X + rect.Width - cut, rect.Y + cut, cut, rect.Height - cut * 2), backgroundImage.Width - cut, cut, cut, backgroundImage.Height - cut * 2, GraphicsUnit.Pixel);
-            //右下角
-            g.DrawImage(backgroundImage, new Rectangle(rect.X + rect.Width - cut, rect.Y + rect.Height - cut, cut, cut), backgroundImage.Width - cut, backgroundImage.Height - cut, cut, cut, GraphicsUnit.Pixel);
-            //下边
-            g.DrawImage(backgroundImage, new Rectangle(rect.X + cut, rect.Y + rect.Height - cut, rect.Width - cut * 2, cut), cut, backgroundImage.Height - cut, backgroundImage.Width - cut * 2, cut, GraphicsUnit.Pixel);
-            //平铺中间
-            g.DrawImage(backgroundImage, new Rectangle(rect.X + cut, rect.Y + cut, rect.Width - cut * 2, rect.Height - cut * 2), cut, cut, backgroundImage.Width - cut * 2, backgroundImage.Height - cut * 2, GraphicsUnit.Pixel);
-        }
+//v_count int;
+//    v_new int:=0; ---0表示否,-1 需要新增箱号
 
-        #endregion
+//BEGIN
+//          --初始化输出参数值
+//          v_o_errmsg:=null;
+//          v_o_outboxcode:=null;
+//          --判定岗位资源
+//          select sc_statuscode,sc_stepcode,sc_linecode,sc_stepname,sc_wccode into v_scstatuscode,v_currentstep,v_linecode,v_stepname ,v_wccode from source where sc_code=v_i_sourcecode;
+//          IF v_scstatuscode<>'AUDITED' or v_scstatuscode is null THEN
+//              v_o_errmsg:='岗位资源不存在或者未审核';
+//RETURN;
+//          END IF;
+          
+//          --获取序列号
+//          select max(ms_id) into v_ms_id from makeserial where ms_sncode = v_i_sncode;
+//          IF(v_ms_id>0)THEN
+//              select ms_outboxcode,ms_prodcode,ms_salecode,ms_makecode,pr_packrule,ms_craftcode,pr_outboxinnerqty,nvl(ms_downstatus,0) into v_ms_outboxcode, v_ms_prodcode, v_ms_salecode, v_ms_makecode, v_pr_packrule, v_ms_craftcode, v_pr_outboxinnerqty, v_ms_downstatus from makeserial left join product on pr_code=ms_prodcode where ms_id=v_ms_id;
+//          ELSE
+//              v_o_errmsg:='序列号:'||v_i_sncode||'不存在';
+//              RETURN;
+//          END IF;
+          
+//          --判断是否下地
+//          IF(v_ms_downstatus<>0)THEN
+//              v_o_errmsg:='序列号:'||v_i_sncode||'不允许采集,下地状态不允许采集';
+//              RETURN;
+//          END IF;
+          
+//          --装箱
+//          IF('IN'=v_i_inorout)THEN
+//             --必须是未装箱,如果是已装箱提示
+//             IF(NVL(v_ms_outboxcode,' ')<>' ')THEN
+//                 IF(v_ms_outboxcode= v_i_outboxcode)THEN
+//                      v_o_errmsg:='序列号:'||v_i_sncode||'已在箱内';
+//                     RETURN;
+//                 ELSE
+//                     v_o_errmsg:='序列号:'||v_i_sncode||'不允许采集,已装入箱号:'||v_ms_outboxcode;
+//                     RETURN;
+//                 END IF;
+//END IF;
+//             --判断有传入需装箱号
+//             IF(nvl(v_i_outboxcode,' ')<>' ')THEN
+//                v_outboxcode :=v_i_outboxcode;
+//              BEGIN
+//                 select pa_id,pa_prodcode,pa_salecode,pa_maKEcode,pa_packtype,pa_standardqty,nvl(pa_currentqty,0),pa_status,pa_downstatus into v_pa_id,v_pa_prodcode,v_pa_salecode,v_pa_makecode,v_pa_packtype,v_pa_standardqty,v_pa_currentqty,v_pa_status,v_pa_downstatus from package where pa_outboxcode=v_i_outboxcode and pa_type=1;
+//                 IF(NVL(v_pa_downstatus,0)<>0)THEN
+//                     v_o_errmsg:='箱号:'||v_i_outboxcode||'处于下地状态,不允许操作!';
+//                     RETURN;
+//                 END IF;
+//EXCEPTION
+//WHEN OTHERS THEN   --需要新增箱号
+//        v_new := -1;
+//              END;
+//            ELSE   --没有传入箱号,并且也没有勾选自动生成箱号
+//               IF(NVL(v_i_autonew,'N')='N')THEN
+//                   v_o_errmsg:='无装箱箱号,请输入装箱箱号或者勾选自动生成箱号!';
+//                   RETURN;
+//               ELSE --生成新箱号
+//                  v_new := -1;
+//                  SP_GETPACKORPALLETCODE('PACKAGE', v_ms_makecode, v_ms_prodcode, v_linecode, v_outboxcode);
+//END IF;
+//END IF;
 
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="g"></param>
-        /// <param name="image"></param>
-        /// <param name="x1"></param>
-        /// <param name="y1"></param>
-        /// <param name="width1"></param>
-        /// <param name="height1"></param>
-        /// <param name="x2"></param>
-        /// <param name="y2"></param>
-        /// <param name="width2"></param>
-        /// <param name="height2"></param>
-        public static void DrawImage(Graphics g, Image image, int x1, int y1, int width1, int height1, int x2, int y2, int width2, int height2)
-        {
-            g.DrawImage(image, new Rectangle(x1, y1, width1, height1), x2, y2, width2, height2, GraphicsUnit.Pixel);
-        }
 
-        #region CreateRoundPath 构建圆角路径
+//            IF(v_i_type= '标准')THEN--标准装箱
+//                IF(v_new= -1)THEN
+//                     ---页面传了标准容量
+//                     /*IF(v_i_standardqty<=0)THEN
+//                         IF(v_pr_outboxinnerqty>0)THEN
+//                            v_pa_standardqty:=v_pr_outboxinnerqty;
+//                         ELSE
+//                             v_outboxcode:=null;
+//                             v_o_errmsg:='请维护箱标准容量或者维护产品资料中的包装容量!';
+//                             RETURN;
+//                         END IF;
+//                     ELSE
+//                        v_pa_standardqty:=v_i_standardqty;
+//                     END IF;*/
+//                     IF(v_pr_outboxinnerqty>0)THEN
+//                           v_pa_standardqty:=v_pr_outboxinnerqty;
+//                     ELSE
+//                          v_outboxcode:=null;
+//                          v_o_errmsg:='请维护箱标准容量或者维护产品资料中的包装容量!';
+//                          RETURN;
+//                     END IF;
+//v_pa_id := package_seq.nextval;    
+//                    insert into package(PA_ID, PA_OUTBOXCODE, PA_PRODCODE, PA_LEVEL, PA_PACKAGEQTY, PA_TOTALQTY,
+//                    PA_MAKECODE, PA_STATUS, PA_INDATE, PA_SALECODE, PA_TYPE, PA_CURRENTQTY, PA_PACKTYPE, PA_STANDARDQTY, PA_SCCODE)
+//                    values(v_pa_id, v_outboxcode,case when nvl(v_pr_packrule,' ')<>'MIX' then v_ms_prodcode ELSE''END,3,0,0,case when v_pr_packrule = 'MAKE' THEN v_ms_makecode ELSE '' END,
+//                    0,SYSDATE,case when v_pr_packrule = 'SALE' then v_ms_salecode else ''end,1,0,v_pr_packrule,v_pa_standardqty,v_i_sourcecode);
+//               ELSE  --无需新增箱号
+//                   --判断箱是否已装满
+//                   IF(v_pa_currentqty= v_pa_standardqty)THEN
+//                        v_o_errmsg:='箱号:'||v_outboxcode||'已经满箱,请输入新箱号或勾选自动生成箱号!';
+//                        RETURN;
+//                   ELSIF(nvl(v_pa_status,0)<>0)THEN
+//                        v_o_errmsg:='箱号:'||v_outboxcode||'已经封箱,请输入新箱号或勾选自动生成箱号!';
+//                        RETURN;
+//                   END IF;
+                   
+//                   --判断序列号包装规则与箱内规则一致
+//                   --IF(v_pa_currentqty= 0 or (v_pa_currentqty>0 and v_pr_packrule = v_pa_packtype))THEN
+//                        IF(v_pa_currentqty>0 and v_pr_packrule = v_pa_packtype)THEN
+//                           IF(v_pr_packrule= 'SALE' AND v_ms_salecode<>v_pa_salecode)THEN
+//                               v_o_errmsg:='包装规则为:合同,序列号和卡通箱合同号不一致,不能装入该箱';
+//                         RETURN;
+//                      ELSIF(v_pr_packrule= 'SALE' AND v_ms_prodcode<>v_pa_prodcode)THEN
+//                         v_o_errmsg:='包装规则为:合同,序列号产品编号'||v_ms_prodcode||'和箱的产品编号'||v_pa_prodcode||'不一致,不能装入该箱';
+//                         RETURN;
+//                      ELSIF(v_pr_packrule= 'MAKE' AND v_ms_makecode<>v_pa_makecode)THEN
+//                          v_o_errmsg:='包装规则为:工单,序列号和卡通箱工单号不一致,不能装入该箱';
+//                         RETURN;
+//                      ELSIF(NVL(v_pr_packrule,'PROD')='PROD' AND v_ms_prodcode<>v_pa_prodcode)THEN
+//                         v_o_errmsg:='序列号:'||v_i_sncode||'产品编号和卡通箱产品编号不一致,不能装入该箱';
+//                         RETURN;
+//                      END IF;
+//                   ELSIF(v_pa_currentqty>0 and NVL(v_pr_packrule,' ')<>NVL(v_pa_packtype,' '))THEN
+//                     v_o_errmsg:='序列号:'||v_i_sncode||'对应产品的包装规则与箱号的包装规则不一致,不能装入同一箱';
+//                      RETURN;
+//                   END IF;
+//END IF;
+//ELSE  --特殊装箱
+//   v_pr_packrule:='SPEC';
+//               IF(v_new= -1)THEN
+//                     ---页面必须传标准容量
+//                     IF(v_i_standardqty<=0)THEN
+//                         v_outboxcode:=null;
+//                         v_o_errmsg:='请维护箱标准容量!';
+//                         RETURN;                        
+//                     END IF;
+//v_pa_id := package_seq.nextval;    
+//                    insert into package(PA_ID, PA_OUTBOXCODE, PA_PRODCODE, PA_LEVEL, PA_PACKAGEQTY, PA_TOTALQTY,
+//                    PA_MAKECODE, PA_STATUS, PA_INDATE, PA_SALECODE, PA_TYPE, PA_CURRENTQTY, PA_PACKTYPE, PA_STANDARDQTY, PA_SCCODE)
+//                    values(v_pa_id, v_outboxcode, v_ms_prodcode,3,0,0,'',0, SYSDATE,'',1,0, v_pr_packrule, v_i_standardqty, v_i_sourcecode);
+//ELSE  --无需新增箱号
+//                   --判断箱是否已装满
+//                   IF(v_pa_currentqty= v_pa_standardqty)THEN
+//                        v_o_errmsg:='箱号:'||v_outboxcode||'已经满箱,请输入新箱号或勾选自动生成箱号!';
+//                        RETURN;
+//                -- ELSIF(nvl(v_pa_status,0)<>0)THEN
+//                --      v_o_errmsg:='箱号:'||v_outboxcode||'已经封箱,请输入新箱号或勾选自动生成箱号!';
+//                --      RETURN;
+//                   END IF;
+//END IF;
+//END IF;  
+//            --装明细
+//            insert into packagedetail(PD_ID, PD_PAID, PD_OUTBOXCODE, PD_INNERQTY, PD_BARCODE, PD_MAKECODE, PD_PRODCODE, PD_BUILDDATE, PD_YMD)
+//            VALUES(packagedetail_seq.NEXTVAL, v_pa_id, v_outboxcode,1, v_i_sncode, v_ms_makecode, v_ms_prodcode, sysdate, to_char(sysdate,'yyyymmdd'));
+//            --更新序列号所在箱号
+//            update makeserial set ms_outboxcode=v_outboxcode,ms_currentstepcode=v_currentstep where ms_id=v_ms_id;
+//               --更新装箱规则 pa_currentqty = 0
+//            update package set pa_packtype = v_pr_packrule, PA_SCCODE = v_i_sourcecode, pa_salecode =case when v_pr_packrule = 'SALE' then v_ms_salecode else ''end,pa_makecode=case when v_pr_packrule = 'MAKE' THEN v_ms_makecode ELSE '' END,pa_prodcode=case when v_pr_packrule<>'MIX' then v_ms_prodcode ELSE''END where pa_outboxcode= v_outboxcode and pa_currentqty = 0;
+//update package set pa_currentqty = nvl(pa_currentqty, 0) + 1, pa_totalqty = nvl(pa_totalqty, 0) + 1, pa_packageqty = nvl(pa_packageqty, 0) + 1 where pa_outboxcode = v_outboxcode;
+//          --取消装箱
+//          ELSIF('OUT'=v_i_inorout)THEN
+//             IF(NVL(v_ms_outboxcode,' ')=' ')THEN
+//                  v_o_errmsg:='序列号没有装箱,无需取消装箱';
+//                  RETURN;
+//             END IF;
+//             --取消装箱必须有箱号v_i_outboxcode
+//             IF(NVL(v_i_outboxcode,' ')=' ' OR v_i_outboxcode = NULL)then
+//                   v_o_errmsg:='请选择需要取消装箱的箱号';
+//                 RETURN;
+//             END IF;
 
-        /// <summary>
-        /// 构建圆角路径
-        /// </summary>
-        /// <param name="rect"></param>
-        /// <param name="cornerRadius"></param>
-        /// <returns></returns>
-        public static GraphicsPath CreateRoundPath(Rectangle rect, int cornerRadius)
-        {
-            GraphicsPath roundedRect = new GraphicsPath();
-            roundedRect.AddArc(rect.X, rect.Y, cornerRadius * 2, cornerRadius * 2, 180, 90);
-            roundedRect.AddLine(rect.X + cornerRadius, rect.Y, rect.Right - cornerRadius * 2, rect.Y);
-            roundedRect.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y, cornerRadius * 2, cornerRadius * 2, 270, 90);
-            roundedRect.AddLine(rect.Right, rect.Y + cornerRadius * 2, rect.Right, rect.Y + rect.Height - cornerRadius * 2);
-            roundedRect.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y + rect.Height - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 0, 90);
-            roundedRect.AddLine(rect.Right - cornerRadius * 2, rect.Bottom, rect.X + cornerRadius * 2, rect.Bottom);
-            roundedRect.AddArc(rect.X, rect.Bottom - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 90, 90);
-            roundedRect.AddLine(rect.X, rect.Bottom - cornerRadius * 2, rect.X, rect.Y + cornerRadius * 2);
-            roundedRect.CloseFigure();
-            return roundedRect;
-        }
 
-        /// <summary>
-        /// 构建圆角路径
-        /// </summary>
-        /// <param name="r"></param>
-        /// <param name="r1"></param>
-        /// <param name="r2"></param>
-        /// <param name="r3"></param>
-        /// <param name="r4"></param>
-        /// <returns></returns>
-        public static GraphicsPath CreateRoundRect(RectangleF r, float r1, float r2, float r3, float r4)
-        {
-            float x = r.X;
-            float y = r.Y;
-            float width = r.Width;
-            float height = r.Height;
-            GraphicsPath path = new GraphicsPath();
-            path.AddBezier(x, y + r1, x, y, x + r1, y, x + r1, y);
-            path.AddLine(x + r1, y, (x + width) - r2, y);
-            path.AddBezier((x + width) - r2, y, x + width, y, x + width, y + r2, x + width, y + r2);
-            path.AddLine((float)(x + width), (float)(y + r2), (float)(x + width), (float)((y + height) - r3));
-            path.AddBezier((float)(x + width), (float)((y + height) - r3), (float)(x + width), (float)(y + height), (float)((x + width) - r3), (float)(y + height), (float)((x + width) - r3), (float)(y + height));
-            path.AddLine((float)((x + width) - r3), (float)(y + height), (float)(x + r4), (float)(y + height));
-            path.AddBezier(x + r4, y + height, x, y + height, x, (y + height) - r4, x, (y + height) - r4);
-            path.AddLine(x, (y + height) - r4, x, y + r1);
-            return path;
-        }
-        #endregion
-    }
-}
+//             IF(v_i_outboxcode<> v_ms_outboxcode)THEN
+//                  v_o_errmsg:='序列号不在箱号:'||v_i_outboxcode||',无法取消装箱';
+//                 RETURN;
+//             END IF;
+//             --箱号未封装,允许取消
+//             select count(1) into v_count from packagedetail where pd_outboxcode = v_i_outboxcode and pd_barcode = v_i_sncode;
+//             IF(v_count= 0)THEN
+//                  v_o_errmsg:='序列号不在箱号:'||v_i_outboxcode||',无法取消装箱';
+//                 RETURN;
+//             END IF;
+//select pa_id, pa_prodcode, pa_status, pa_checkno, pa_currentqty, pa_downstatus into v_pa_id, v_pa_prodcode, v_pa_status, v_pa_checkno, v_pa_currentqty, v_pa_downstatus from package where pa_outboxcode = v_i_outboxcode and pa_type = 1;
+//             IF(NVL(v_pa_downstatus,0)<>0)THEN
+//                   v_o_errmsg:='箱号:'||v_i_outboxcode||'处于下地状态,不允许操作!';
+//                   RETURN;
+//              END IF;
+
+//delete from packagedetail where pd_outboxcode=v_i_outboxcode and pd_barcode=v_i_sncode; 
+//              --更新序列号所在箱号
+//              update makeserial set ms_outboxcode='',ms_currentstepcode=null where ms_id = v_ms_id;
+//              --更新数量,抽检批次号,更新未封箱
+//              update package set pa_currentqty=pa_currentqty-1,pa_totalqty=pa_totalqty-1,pa_packageqty=pa_packageqty-1,pa_status=0 where pa_outboxcode = v_i_outboxcode;
+//update package set pa_packtype = null, pa_sccode = null, pa_checkno = null, pa_salecode = null, pa_makecode = null, pa_prodcode = null where pa_outboxcode = v_i_outboxcode and pa_currentqty = 0;
+//              IF(nvl(v_pa_checkno,' ')<>' ')THEN
+//                  --未断批直接移除,更新数量
+//                 select MAX(OB_STATUS) INTO v_ob_status from oqcbatch where ob_checkno = v_pa_checkno;
+//                 IF(NVL(v_ob_status,' ')=' ' or v_ob_status = 'ENTERING')THEN
+//                   --更新序列号抽检批次号
+//                    update makeserial set ms_checkno=null where ms_id = v_ms_id;
+//                    --删除oqcbatchdetail
+//                    delete from oqcbatchdetail where obd_checkno = v_pa_checkno and obd_sncode = v_i_sncode;
+//                    --更新OQCBATCH 数量
+//                    update OQCBATCH set ob_nowcheckqty = ob_nowcheckqty - 1 where ob_checkno = v_pa_checkno;
+//END IF;
+//END IF;
+//              --如果序列号已有抽检批次号,
+//            /* IF(nvl(v_pa_checkno,' ')<>' ')THEN
+//                 --未断批直接移除,更新数量
+//                 select MAX(OB_STATUS) INTO v_ob_status from oqcbatch where ob_checkno=v_pa_checkno;
+//                 IF(NVL(v_ob_status,' ')=' ' or v_ob_status='ENTERING')THEN
+//                     --取消装箱
+//                     delete from packagedetail where pd_outboxcode=v_i_outboxcode and pd_barcode=v_i_sncode; 
+//                     --更新序列号所在箱号
+//                     update makeserial set ms_outboxcode='',ms_checkno='',ms_currentstepcode=null where ms_id=v_ms_id;
+//                     --更新数量,抽检批次号,更新未封箱
+//                     update package set pa_currentqty=pa_currentqty-1,pa_status=0 where pa_outboxcode=v_i_outboxcode;
+//                     update package set pa_packtype='',pa_checkno='',pa_sccode='' where pa_outboxcode=v_i_outboxcode and pa_currentqty=0;
+//                     --删除oqcbatchdetail
+//                     delete from oqcbatchdetail where obd_checkno=v_pa_checkno and obd_sncode=v_i_sncode;
+//                     --更新OQCBATCH 数量
+//                     update OQCBATCH set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno=v_pa_checkno;
+//                 ELSE
+//                     v_o_errmsg:='序列号对应的抽检批次号已经断批.不允许取消装箱';
+//                     RETURN;
+//                 END IF;  
+//             ELSE  --无送检批次号
+//                  delete from packagedetail where pd_outboxcode=v_i_outboxcode and pd_barcode=v_i_sncode; 
+//                  --更新序列号所在箱号
+//                  update makeserial set ms_outboxcode='',ms_currentstepcode=null where ms_id=v_ms_id;
+//                  --更新数量,抽检批次号,更新未封箱
+//                  update package set pa_currentqty=pa_currentqty-1,pa_status=0 where pa_outboxcode=v_i_outboxcode;
+//                  update package set pa_packtype='',pa_sccode='' where pa_outboxcode=v_i_outboxcode and pa_currentqty=0;
+//             END IF; */
+//             --修改完工状态,mcd_inqty
+//             v_o_outboxcode:=v_i_outboxcode;
+//          END IF;
+//EXCEPTION--统一的异常捕捉
+//  WHEN OTHERS THEN
+//      BEGIN
+//          v_o_errmsg:=SQLERRM;
+//          ROLLBACK;
+//          IF SQLCODE<> 0 THEN
+//            BEGIN
+//               v_o_errmsg := v_o_errmsg || dbms_utility.format_error_backtrace();
+//END;
+//          END IF;
+//END;
+//   END;

+ 1 - 1
UAS-出货标签管理(泽天)/PublicMethod/ExcelHandler.cs

@@ -20,7 +20,7 @@ namespace UAS_LabelMachine
             MemoryStream ms;
             ms = DataTableToExcel(dt);
             //以系统当前时间命名文件,FileMode.Create表示创建文件,FileAccess.Write表示拥有写的权限
-            string filePath = @FolderPath + "\\" + FileName + ".xlsx";
+            string filePath = @FolderPath + "\\" + FileName + ".xls";
             FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
             byte[] data = ms.ToArray();
             fs.Write(data, 0, data.Length);

+ 4 - 2
UAS-出货标签管理(泽天)/UAS_出货标签管理.Designer.cs

@@ -28,6 +28,7 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UAS_出货标签打印));
             this.pi_inoutno_label = new System.Windows.Forms.Label();
@@ -37,7 +38,7 @@
             this.pib_id = new System.Windows.Forms.Label();
             this.pi_cardcode = new System.Windows.Forms.Label();
             this.Fresh = new System.Windows.Forms.LinkLabel();
-            this.RefreshDBConnect = new System.Windows.Forms.Timer();
+            this.RefreshDBConnect = new System.Windows.Forms.Timer(this.components);
             this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -64,7 +65,7 @@
             this.dataGridViewTextBoxColumn21 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn22 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn23 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.MidSource = new System.Windows.Forms.BindingSource();
+            this.MidSource = new System.Windows.Forms.BindingSource(this.components);
             this.ChooseAll = new System.Windows.Forms.Button();
             this.ExportFileDialog = new System.Windows.Forms.FolderBrowserDialog();
             this.AttachInfo = new System.Windows.Forms.Button();
@@ -1416,6 +1417,7 @@
             this.OutBoxNum.Size = new System.Drawing.Size(72, 25);
             this.OutBoxNum.TabIndex = 91;
             this.OutBoxNum.SelectedIndexChanged += new System.EventHandler(this.OutBoxNum_SelectedIndexChanged);
+            this.OutBoxNum.SelectionChangeCommitted += new System.EventHandler(this.OutBoxNum_SelectionChangeCommitted);
             this.OutBoxNum.Click += new System.EventHandler(this.OutBoxNum_Click);
             // 
             // label10

+ 18 - 2
UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

@@ -782,7 +782,7 @@ namespace UAS_LabelMachine
                     SelectProdcode = LabelInf.Rows[SelectRowIndex].Cells["pib_prodcode"].Value.ToString();
                     for (int i = SelectRowIndex; i >= 0; i--)
                     {
-                        if (LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString().ToLower() != "true")
+                        if ((LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString().ToLower() != "true") || i == SelectRowIndex)
                         {
                             LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
                             if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
@@ -798,7 +798,7 @@ namespace UAS_LabelMachine
                     }
                     for (int i = SelectRowIndex; i < LabelInf.Rows.Count - 1; i++)
                     {
-                        if (LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_ifprint"].Value.ToString().ToLower() != "true")
+                        if ((LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString().ToLower() != "true") || i == SelectRowIndex)
                         {
                             LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
                             if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
@@ -1005,6 +1005,7 @@ namespace UAS_LabelMachine
                 OutReport.Print();
                 Properties.Settings.Default.OPrinter = OutBoxPrinter.Text;
                 Properties.Settings.Default.Save();
+                dh.UpdateByCondition("prodiobarcode", "pib_outifprint=-1", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "'");
             }
         }
 
@@ -1747,6 +1748,10 @@ namespace UAS_LabelMachine
 
         private void OutBoxNum_SelectedIndexChanged(object sender, EventArgs e)
         {
+            if (!ComBoxClickChangeLabelDoc)
+            {
+                OutBoxNum1 = OutBoxNum.Text;
+            }
             LoadGridData(sender, e);
         }
 
@@ -1758,5 +1763,16 @@ namespace UAS_LabelMachine
                 SelectRowIndex = dsc[0].Index;
             }
         }
+
+        string OutBoxNum1 = "";
+        private void OutBoxNum_SelectionChangeCommitted(object sender, EventArgs e)
+        {
+            if (OutBoxNum1 != "全部" && OutBoxNum1 != "新增")
+                if (dh.getFieldDataByCondition("prodiobarcode", "pib_outifprint", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + OutBoxNum1 + "'").ToString() != "-1")
+                {
+                    MessageBox.Show("外箱号" + OutBoxNum1 + "尚未打印标签");
+                }
+            OutBoxNum1 = OutBoxNum.Text;
+        }
     }
 }