Просмотр исходного кода

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

caosy 6 лет назад
Родитель
Сommit
249a3fe577

+ 1 - 1
PLCDataReader/Device/Information/DeviceDetailInfo.cs

@@ -67,7 +67,7 @@ namespace UAS_PLCDataReader.Device.Infomation
             {
                 BaseUtil.SetFormValue(Controls, dt);
             }
-            dt = (DataTable)dh.ExecuteSql("SELECT DC_CODE,DC_NAME,to_char(DPC_ENABLE)DPC_ENABLE FROM DEVICEPOLLINGCONFIG LEFT JOIN DEVICECOMMAND ON DPC_DCCODE=DC_CODE WHERE DPC_DECODE='" + de_code + "'", "select");
+            dt = (DataTable)dh.ExecuteSql("SELECT DC_CODE,DC_NAME,to_char(DPC_ENABLE)DPC_ENABLE FROM DEVICEPOLLINGCONFIG LEFT JOIN DEVICECOMMAND ON DPC_DCCODE=DC_CODE WHERE DPC_DECODE='" + de_code + "' and rownum<50", "select");
             GridDeviceDetailInfo.DataSource = dt;
         }
 

+ 2 - 2
PLCDataReader/Device/Information/DeviceStatusInfo.cs

@@ -35,7 +35,7 @@ namespace UAS_PLCDataReader.Device.Infomation
             //查询设备基础信息
             sql.Clear();
             sql.Append("select de_linecode,de_wccode,de_name,de_address,de_sourcecode,sc_name from device ");
-            sql.Append("left join source on sc_code=de_sourcecode where de_code='" + de_code + "'");
+            sql.Append("left join source on sc_code=de_sourcecode where de_code='" + de_code + "' and rownum<50 ");
             DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             if (dt.Rows.Count > 0)
             {
@@ -57,7 +57,7 @@ namespace UAS_PLCDataReader.Device.Infomation
             GridViewDeviceStatusInfo.BestFitColumns();
             sql.Clear();
             //查询设备运行日志
-            sql.Append("select * from DEVICERUNRECORD where drr_decode='" + de_code + "'");
+            sql.Append("select * from DEVICERUNRECORD where drr_decode='" + de_code + "' and rownum<50 ");
             GridDeviceRunLog.DataSource = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             GridViewDeviceRunLog.BestFitColumns();
             sql.Clear();

+ 1 - 1
PLCDataReader/Main.cs

@@ -210,7 +210,7 @@ namespace UAS_PLCDataReader
 
             GridDeviceData.GetDataSQL = "select dr_decode,dr_dename,case when dr_runstatus='disconnect' then '无法连接' when dr_runstatus='stopped' then '未运行' when dr_runstatus='running' then '运行中' when dr_runstatus='noanswer' then '无应答' end dr_runstatus,dr_qty,dr_okqty,de_item1||':'||dr_value1 dr_value1,de_item2||':'||dr_value2 dr_value2,de_item3||':'||dr_value3 dr_value3,de_item4||':'||dr_value4 dr_value4,de_item5||':'||dr_value5 dr_value5,de_item6||':'||dr_value6 dr_value6,de_item7||':'||dr_value7 dr_value7,de_item8||':'||dr_value8 dr_value8,de_item9||':'||dr_value9 dr_value9,de_item10||':'||dr_value10 dr_value10 from devicerunstatus left join device on dr_decode=de_code order by dr_decode";
 
-            GridDeviceRunLog.GetDataSQL = "SELECT drr_id,drr_decode,drr_dename,to_char(drr_date,'YYYY-MM-DD hh24:mi:ss')drr_date,drr_doman,drr_remark,drr_logstatus FROM DEVICERUNRECORD order by drr_id desc";
+            GridDeviceRunLog.GetDataSQL = "SELECT drr_id,drr_decode,drr_dename,to_char(drr_date,'YYYY-MM-DD hh24:mi:ss')drr_date,drr_doman,drr_remark,drr_logstatus FROM DEVICERUNRECORD where rownum<500 order by drr_id desc";
             GridDeviceRunLog.ID = "drr_id";
             GridDeviceRunLog.TableName = "DEVICERUNRECORD";
 

+ 6 - 1
PLCDataReader/UAS_PLCDataReader.csproj

@@ -328,7 +328,6 @@
     <EmbeddedResource Include="MainWindow.resx">
       <DependentUpon>MainWindow.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="Properties\licenses.licx" />
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -403,6 +402,12 @@
   <ItemGroup>
     <Folder Include="Device\Transfer\" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\UAS-出货标签管理%28吉利通%29\UAS-出货标签管理%28吉利通%29.csproj">
+      <Project>{9520C162-69BE-41D0-BE89-3E702B746A48}</Project>
+      <Name>UAS-出货标签管理%28吉利通%29</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

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

@@ -180,6 +180,7 @@
             this.OutboxCapacity = new System.Windows.Forms.NumericUpDown();
             this.OutBoxLabelPrint = new System.Windows.Forms.Button();
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
+            this.BoxCount = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             this.groupBoxWithBorder2.SuspendLayout();
@@ -482,7 +483,7 @@
             // ChooseAll
             // 
             this.ChooseAll.Location = new System.Drawing.Point(0, 379);
-            this.ChooseAll.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.ChooseAll.Margin = new System.Windows.Forms.Padding(2);
             this.ChooseAll.Name = "ChooseAll";
             this.ChooseAll.Size = new System.Drawing.Size(38, 22);
             this.ChooseAll.TabIndex = 84;
@@ -671,7 +672,7 @@
             this.Combindetail.AutoSize = true;
             this.Combindetail.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.Combindetail.Location = new System.Drawing.Point(296, 102);
-            this.Combindetail.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.Combindetail.Margin = new System.Windows.Forms.Padding(2);
             this.Combindetail.Name = "Combindetail";
             this.Combindetail.Size = new System.Drawing.Size(82, 21);
             this.Combindetail.TabIndex = 104;
@@ -723,7 +724,7 @@
             this.CombindetailTwo.AutoSize = true;
             this.CombindetailTwo.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.CombindetailTwo.Location = new System.Drawing.Point(296, 130);
-            this.CombindetailTwo.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.CombindetailTwo.Margin = new System.Windows.Forms.Padding(2);
             this.CombindetailTwo.Name = "CombindetailTwo";
             this.CombindetailTwo.Size = new System.Drawing.Size(119, 21);
             this.CombindetailTwo.TabIndex = 109;
@@ -761,10 +762,10 @@
             this.groupBoxWithBorder2.Controls.Add(this.ButtonWeigh);
             this.groupBoxWithBorder2.Controls.Add(this.Weight);
             this.groupBoxWithBorder2.Location = new System.Drawing.Point(1135, 222);
-            this.groupBoxWithBorder2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.groupBoxWithBorder2.Margin = new System.Windows.Forms.Padding(2);
             this.groupBoxWithBorder2.Name = "groupBoxWithBorder2";
-            this.groupBoxWithBorder2.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
-            this.groupBoxWithBorder2.Size = new System.Drawing.Size(112, 155);
+            this.groupBoxWithBorder2.Padding = new System.Windows.Forms.Padding(2);
+            this.groupBoxWithBorder2.Size = new System.Drawing.Size(123, 155);
             this.groupBoxWithBorder2.TabIndex = 113;
             this.groupBoxWithBorder2.TabStop = false;
             this.groupBoxWithBorder2.Text = "称重";
@@ -798,7 +799,7 @@
             this.Weight.AutoSize = true;
             this.Weight.Font = new System.Drawing.Font("微软雅黑", 30F);
             this.Weight.ForeColor = System.Drawing.Color.Red;
-            this.Weight.Location = new System.Drawing.Point(9, 34);
+            this.Weight.Location = new System.Drawing.Point(8, 33);
             this.Weight.Name = "Weight";
             this.Weight.Size = new System.Drawing.Size(0, 52);
             this.Weight.TabIndex = 113;
@@ -1009,9 +1010,9 @@
             this.groupBoxWithBorder1.Controls.Add(this.label12);
             this.groupBoxWithBorder1.Controls.Add(this.label7);
             this.groupBoxWithBorder1.Location = new System.Drawing.Point(575, 6);
-            this.groupBoxWithBorder1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.groupBoxWithBorder1.Margin = new System.Windows.Forms.Padding(2);
             this.groupBoxWithBorder1.Name = "groupBoxWithBorder1";
-            this.groupBoxWithBorder1.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.groupBoxWithBorder1.Padding = new System.Windows.Forms.Padding(2);
             this.groupBoxWithBorder1.Size = new System.Drawing.Size(140, 211);
             this.groupBoxWithBorder1.TabIndex = 81;
             this.groupBoxWithBorder1.TabStop = false;
@@ -1033,7 +1034,7 @@
             // 
             this.label18.AutoSize = true;
             this.label18.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label18.Location = new System.Drawing.Point(68, 126);
+            this.label18.Location = new System.Drawing.Point(67, 125);
             this.label18.Name = "label18";
             this.label18.Size = new System.Drawing.Size(13, 17);
             this.label18.TabIndex = 90;
@@ -1067,7 +1068,7 @@
             // 
             this.label16.AutoSize = true;
             this.label16.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label16.Location = new System.Drawing.Point(66, 62);
+            this.label16.Location = new System.Drawing.Point(65, 61);
             this.label16.Name = "label16";
             this.label16.Size = new System.Drawing.Size(13, 17);
             this.label16.TabIndex = 87;
@@ -1101,7 +1102,7 @@
             // 
             this.label12.AutoSize = true;
             this.label12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label12.Location = new System.Drawing.Point(10, 92);
+            this.label12.Location = new System.Drawing.Point(9, 91);
             this.label12.Name = "label12";
             this.label12.Size = new System.Drawing.Size(56, 17);
             this.label12.TabIndex = 77;
@@ -1111,7 +1112,7 @@
             // 
             this.label7.AutoSize = true;
             this.label7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label7.Location = new System.Drawing.Point(8, 30);
+            this.label7.Location = new System.Drawing.Point(7, 29);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(56, 17);
             this.label7.TabIndex = 76;
@@ -1166,7 +1167,7 @@
             this.LabelInf.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.LabelInf.Name = "LabelInf";
             this.LabelInf.RowTemplate.Height = 23;
-            this.LabelInf.Size = new System.Drawing.Size(1250, 346);
+            this.LabelInf.Size = new System.Drawing.Size(1258, 346);
             this.LabelInf.TabIndex = 27;
             this.LabelInf.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.LabelInf_CellClick);
             this.LabelInf.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.LabelInf_DataError);
@@ -1399,7 +1400,7 @@
             this.SingleLabel.Location = new System.Drawing.Point(718, 6);
             this.SingleLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabel.Name = "SingleLabel";
-            this.SingleLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.SingleLabel.Padding = new System.Windows.Forms.Padding(2);
             this.SingleLabel.Size = new System.Drawing.Size(170, 211);
             this.SingleLabel.TabIndex = 77;
             this.SingleLabel.TabStop = false;
@@ -1418,7 +1419,7 @@
             // 
             this.SingleLabelPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.SingleLabelPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelPrint.Location = new System.Drawing.Point(84, 178);
+            this.SingleLabelPrint.Location = new System.Drawing.Point(55, 177);
             this.SingleLabelPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabelPrint.Name = "SingleLabelPrint";
             this.SingleLabelPrint.Size = new System.Drawing.Size(68, 26);
@@ -1433,7 +1434,7 @@
             this.SingleLabelAutoPrint.Checked = true;
             this.SingleLabelAutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.SingleLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(14, 98);
+            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(13, 97);
             this.SingleLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabelAutoPrint.Name = "SingleLabelAutoPrint";
             this.SingleLabelAutoPrint.Size = new System.Drawing.Size(75, 21);
@@ -1468,8 +1469,8 @@
             this.MidLabel.Location = new System.Drawing.Point(890, 6);
             this.MidLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.MidLabel.Name = "MidLabel";
-            this.MidLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
-            this.MidLabel.Size = new System.Drawing.Size(172, 211);
+            this.MidLabel.Padding = new System.Windows.Forms.Padding(2);
+            this.MidLabel.Size = new System.Drawing.Size(175, 211);
             this.MidLabel.TabIndex = 78;
             this.MidLabel.TabStop = false;
             this.MidLabel.Text = "中盒标签";
@@ -1480,7 +1481,7 @@
             this.CurrentRowOnly.Checked = true;
             this.CurrentRowOnly.CheckState = System.Windows.Forms.CheckState.Checked;
             this.CurrentRowOnly.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CurrentRowOnly.Location = new System.Drawing.Point(89, 99);
+            this.CurrentRowOnly.Location = new System.Drawing.Point(85, 98);
             this.CurrentRowOnly.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.CurrentRowOnly.Name = "CurrentRowOnly";
             this.CurrentRowOnly.Size = new System.Drawing.Size(87, 21);
@@ -1506,7 +1507,7 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(10, 126);
+            this.label2.Location = new System.Drawing.Point(9, 125);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(32, 17);
             this.label2.TabIndex = 92;
@@ -1529,7 +1530,7 @@
             // 
             this.label5.AutoSize = true;
             this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label5.Location = new System.Drawing.Point(10, 158);
+            this.label5.Location = new System.Drawing.Point(9, 157);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(32, 17);
             this.label5.TabIndex = 50;
@@ -1562,7 +1563,7 @@
             this.MidLabelAutoPrint.Checked = true;
             this.MidLabelAutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.MidLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MidLabelAutoPrint.Location = new System.Drawing.Point(14, 98);
+            this.MidLabelAutoPrint.Location = new System.Drawing.Point(7, 97);
             this.MidLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.MidLabelAutoPrint.Name = "MidLabelAutoPrint";
             this.MidLabelAutoPrint.Size = new System.Drawing.Size(75, 21);
@@ -1584,6 +1585,7 @@
             // 
             // OutBoxLabel
             // 
+            this.OutBoxLabel.Controls.Add(this.BoxCount);
             this.OutBoxLabel.Controls.Add(this.DiffLotNo);
             this.OutBoxLabel.Controls.Add(this.DiffDC);
             this.OutBoxLabel.Controls.Add(this.OnlyOneRow);
@@ -1598,11 +1600,11 @@
             this.OutBoxLabel.Controls.Add(this.OutBoxLabelPrint);
             this.OutBoxLabel.Controls.Add(this.OutBoxCombox);
             this.OutBoxLabel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutBoxLabel.Location = new System.Drawing.Point(1067, 6);
-            this.OutBoxLabel.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.OutBoxLabel.Location = new System.Drawing.Point(1070, 6);
+            this.OutBoxLabel.Margin = new System.Windows.Forms.Padding(2);
             this.OutBoxLabel.Name = "OutBoxLabel";
-            this.OutBoxLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
-            this.OutBoxLabel.Size = new System.Drawing.Size(183, 211);
+            this.OutBoxLabel.Padding = new System.Windows.Forms.Padding(2);
+            this.OutBoxLabel.Size = new System.Drawing.Size(188, 211);
             this.OutBoxLabel.TabIndex = 79;
             this.OutBoxLabel.TabStop = false;
             this.OutBoxLabel.Text = "外箱标签";
@@ -1611,7 +1613,7 @@
             // 
             this.DiffLotNo.AutoSize = true;
             this.DiffLotNo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.DiffLotNo.Location = new System.Drawing.Point(108, 152);
+            this.DiffLotNo.Location = new System.Drawing.Point(117, 149);
             this.DiffLotNo.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.DiffLotNo.Name = "DiffLotNo";
             this.DiffLotNo.Size = new System.Drawing.Size(67, 21);
@@ -1623,7 +1625,7 @@
             // 
             this.DiffDC.AutoSize = true;
             this.DiffDC.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.DiffDC.Location = new System.Drawing.Point(108, 122);
+            this.DiffDC.Location = new System.Drawing.Point(117, 122);
             this.DiffDC.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.DiffDC.Name = "DiffDC";
             this.DiffDC.Size = new System.Drawing.Size(68, 21);
@@ -1635,7 +1637,7 @@
             // 
             this.OnlyOneRow.AutoSize = true;
             this.OnlyOneRow.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OnlyOneRow.Location = new System.Drawing.Point(118, 98);
+            this.OnlyOneRow.Location = new System.Drawing.Point(117, 97);
             this.OnlyOneRow.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OnlyOneRow.Name = "OnlyOneRow";
             this.OnlyOneRow.Size = new System.Drawing.Size(63, 21);
@@ -1647,7 +1649,7 @@
             // 
             this.AllLabel.AutoSize = true;
             this.AllLabel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.AllLabel.Location = new System.Drawing.Point(12, 98);
+            this.AllLabel.Location = new System.Drawing.Point(11, 97);
             this.AllLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.AllLabel.Name = "AllLabel";
             this.AllLabel.Size = new System.Drawing.Size(99, 21);
@@ -1658,7 +1660,7 @@
             // AddNewOutBox
             // 
             this.AddNewOutBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.AddNewOutBox.Location = new System.Drawing.Point(16, 178);
+            this.AddNewOutBox.Location = new System.Drawing.Point(61, 178);
             this.AddNewOutBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.AddNewOutBox.Name = "AddNewOutBox";
             this.AddNewOutBox.Size = new System.Drawing.Size(51, 26);
@@ -1670,7 +1672,7 @@
             // LogingOut
             // 
             this.LogingOut.AutoSize = true;
-            this.LogingOut.Location = new System.Drawing.Point(104, 10);
+            this.LogingOut.Location = new System.Drawing.Point(115, 9);
             this.LogingOut.Name = "LogingOut";
             this.LogingOut.Size = new System.Drawing.Size(42, 21);
             this.LogingOut.TabIndex = 77;
@@ -1684,7 +1686,7 @@
             this.OutBoxNum.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.OutBoxNum.Items.AddRange(new object[] {
             "新增"});
-            this.OutBoxNum.Location = new System.Drawing.Point(52, 149);
+            this.OutBoxNum.Location = new System.Drawing.Point(61, 149);
             this.OutBoxNum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutBoxNum.Name = "OutBoxNum";
             this.OutBoxNum.Size = new System.Drawing.Size(52, 25);
@@ -1697,7 +1699,7 @@
             // 
             this.label10.AutoSize = true;
             this.label10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(12, 160);
+            this.label10.Location = new System.Drawing.Point(17, 154);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(32, 17);
             this.label10.TabIndex = 90;
@@ -1707,7 +1709,7 @@
             // 
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label6.Location = new System.Drawing.Point(12, 126);
+            this.label6.Location = new System.Drawing.Point(17, 125);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(32, 17);
             this.label6.TabIndex = 87;
@@ -1716,16 +1718,16 @@
             // OutBoxPrinter
             // 
             this.OutBoxPrinter.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutBoxPrinter.Location = new System.Drawing.Point(8, 63);
+            this.OutBoxPrinter.Location = new System.Drawing.Point(7, 63);
             this.OutBoxPrinter.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
             this.OutBoxPrinter.Name = "OutBoxPrinter";
-            this.OutBoxPrinter.Size = new System.Drawing.Size(158, 25);
+            this.OutBoxPrinter.Size = new System.Drawing.Size(177, 25);
             this.OutBoxPrinter.TabIndex = 82;
             // 
             // OutboxCapacity
             // 
             this.OutboxCapacity.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutboxCapacity.Location = new System.Drawing.Point(52, 120);
+            this.OutboxCapacity.Location = new System.Drawing.Point(61, 120);
             this.OutboxCapacity.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutboxCapacity.Name = "OutboxCapacity";
             this.OutboxCapacity.Size = new System.Drawing.Size(50, 23);
@@ -1740,10 +1742,10 @@
             // OutBoxLabelPrint
             // 
             this.OutBoxLabelPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutBoxLabelPrint.Location = new System.Drawing.Point(85, 178);
+            this.OutBoxLabelPrint.Location = new System.Drawing.Point(118, 178);
             this.OutBoxLabelPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutBoxLabelPrint.Name = "OutBoxLabelPrint";
-            this.OutBoxLabelPrint.Size = new System.Drawing.Size(76, 26);
+            this.OutBoxLabelPrint.Size = new System.Drawing.Size(67, 26);
             this.OutBoxLabelPrint.TabIndex = 80;
             this.OutBoxLabelPrint.Text = "打印箱标";
             this.OutBoxLabelPrint.UseVisualStyleBackColor = true;
@@ -1754,19 +1756,28 @@
             this.OutBoxCombox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.OutBoxCombox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.OutBoxCombox.FormattingEnabled = true;
-            this.OutBoxCombox.Location = new System.Drawing.Point(8, 31);
+            this.OutBoxCombox.Location = new System.Drawing.Point(7, 31);
             this.OutBoxCombox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutBoxCombox.Name = "OutBoxCombox";
-            this.OutBoxCombox.Size = new System.Drawing.Size(158, 25);
+            this.OutBoxCombox.Size = new System.Drawing.Size(177, 25);
             this.OutBoxCombox.TabIndex = 78;
             this.OutBoxCombox.SelectedIndexChanged += new System.EventHandler(this.OutBoxCombox_SelectedIndexChanged);
             // 
+            // BoxCount
+            // 
+            this.BoxCount.AutoSize = true;
+            this.BoxCount.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.BoxCount.Location = new System.Drawing.Point(8, 183);
+            this.BoxCount.Name = "BoxCount";
+            this.BoxCount.Size = new System.Drawing.Size(0, 17);
+            this.BoxCount.TabIndex = 97;
+            // 
             // UAS_出货标签打印
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(233)))), ((int)(((byte)(206)))));
-            this.ClientSize = new System.Drawing.Size(1256, 530);
+            this.ClientSize = new System.Drawing.Size(1261, 731);
             this.Controls.Add(this.groupBoxWithBorder2);
             this.Controls.Add(this.GetPDdata);
             this.Controls.Add(this.Reset);
@@ -1820,21 +1831,21 @@
             this.SizeChanged += new System.EventHandler(this.贴标机条码打印_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
-            this.groupBoxWithBorder2.ResumeLayout(true);
+            this.groupBoxWithBorder2.ResumeLayout(false);
             this.groupBoxWithBorder2.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.GridPrcode)).EndInit();
-            this.groupBoxWithBorder1.ResumeLayout(true);
+            this.groupBoxWithBorder1.ResumeLayout(false);
             this.groupBoxWithBorder1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.LabelInf)).EndInit();
-            this.SingleLabel.ResumeLayout(true);
+            this.SingleLabel.ResumeLayout(false);
             this.SingleLabel.PerformLayout();
-            this.MidLabel.ResumeLayout(true);
+            this.MidLabel.ResumeLayout(false);
             this.MidLabel.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.MidboxCapacity)).EndInit();
-            this.OutBoxLabel.ResumeLayout(true);
+            this.OutBoxLabel.ResumeLayout(false);
             this.OutBoxLabel.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.OutboxCapacity)).EndInit();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }
@@ -1989,5 +2000,6 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_brand;
         private System.Windows.Forms.DataGridViewTextBoxColumn pjd_zxbzs_user;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec1;
+        private System.Windows.Forms.Label BoxCount;
     }
 }

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

@@ -1261,6 +1261,7 @@ namespace UAS_LabelMachine
             }
             sql.Append(" order by to_number(pib_outboxcode2),pib_id,pd_prodcode");
             LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            BoxCount.Text = LabelInfDataTable.Compute("sum(pib_qty)", "1=1").ToString()+"KPCS";
             bindingsource(LabelInf, LabelInfDataTable);
             if (LabelInf.Rows.Count > 0)
             {

+ 1 - 1
UAS-出货标签管理(贸易版)/PublicMethod/Print.cs

@@ -354,7 +354,7 @@ namespace UAS_LabelMachine.PublicMethod
                 }
                 if (iCustProdCode || iCustPo || iDC || iLotNo)
                 {
-                    GroupByCondition = " group by "+(GroupByCondition.Substring(0, GroupByCondition.Length - 1));
+                    GroupByCondition = " group by " + (GroupByCondition.Substring(0, GroupByCondition.Length - 1));
                 }
                 sql.Append("1,");
                 DataTable dt = (DataTable)SystemInf.sdh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno + "' and pib_outboxcode2=" + (pib_outboxcode2 == "" ? "0" : pib_outboxcode2) + GroupByCondition, "select");

+ 5 - 2
UAS-出货标签管理(贸易版)/ReSetMaxNum.cs

@@ -17,9 +17,12 @@ namespace UAS_LabelMachine
 
         string custcode;
 
-        public ReSetMaxNum(string iCustCode)
+        string inoutno;
+
+        public ReSetMaxNum(string iCustCode,string iInoutno)
         {
             custcode = iCustCode;
+            inoutno = iInoutno;
             InitializeComponent();
         }
         //前缀
@@ -78,7 +81,7 @@ namespace UAS_LabelMachine
                             //替换参数后重新执行SQL
                             foreach (Match mch in match.Matches(SQL))
                             {
-                                SQL = SQL.Replace(mch.Value.Trim(), "'" + this.Number.Text + "'");
+                                SQL = SQL.Replace(mch.Value.Trim(), "'"+ inoutno + "'");
                             }
                             Temp = (DataTable)dh.ExecuteSql(SQL, "select");
                         }

+ 9 - 9
UAS-出货标签管理(贸易版)/UAS_出货标签管理.Designer.cs

@@ -178,7 +178,7 @@
             this.pib_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_orispeccode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_brand = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_brand = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_madein = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_zxbzs = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_unit = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -1224,7 +1224,7 @@
             this.pib_pdno,
             this.pib_prodcode,
             this.pr_orispeccode,
-            this.pr_brand,
+            this.pib_brand,
             this.pib_madein,
             this.pr_zxbzs,
             this.pr_unit,
@@ -1784,13 +1784,13 @@
             this.pr_orispeccode.ReadOnly = true;
             this.pr_orispeccode.Width = 48;
             // 
-            // pr_brand
+            // pib_brand
             // 
-            this.pr_brand.DataPropertyName = "pr_brand";
-            this.pr_brand.HeaderText = "品牌";
-            this.pr_brand.Name = "pr_brand";
-            this.pr_brand.ReadOnly = true;
-            this.pr_brand.Width = 54;
+            this.pib_brand.DataPropertyName = "pib_brand";
+            this.pib_brand.HeaderText = "品牌";
+            this.pib_brand.Name = "pib_brand";
+            this.pib_brand.ReadOnly = true;
+            this.pib_brand.Width = 54;
             // 
             // pib_madein
             // 
@@ -2162,7 +2162,7 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_pdno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_prodcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_orispeccode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pr_brand;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pib_brand;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_madein;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_zxbzs;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_unit;

+ 74 - 43
UAS-出货标签管理(贸易版)/UAS_出货标签管理.cs

@@ -516,7 +516,7 @@ namespace UAS_LabelMachine
                     string date = "";
                     string lotno = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
                     string datecode = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
-                    string pr_brand = LabelInf.Rows[CurrentRowIndex].Cells["pr_brand"].Value.ToString();
+                    string pr_brand = LabelInf.Rows[CurrentRowIndex].Cells["pib_brand"].Value.ToString();
                     LogicHandler.GetTimeFromDatecode(datecode, pr_brand, out year, out month, out day, out date);
                     if (CollectionUnit.Text == "盒")
                     {
@@ -754,7 +754,7 @@ namespace UAS_LabelMachine
                         length--;
                         break;
                     case "品牌":
-                        cell = LabelInf.Rows[CurrentRowIndex].Cells["pr_brand"];
+                        cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_brand"];
                         Matchstr = MatchStr(item.Value, "品牌");
                         //如果采集的数量不相等的话
                         if (cell.Value.ToString() != Matchstr)
@@ -819,7 +819,7 @@ namespace UAS_LabelMachine
                 string month = "";
                 string day = "";
                 string date = "";
-                string pr_brand = LabelInf.Rows[CurrentRowIndex].Cells["pr_brand"].Value.ToString();
+                string pr_brand = LabelInf.Rows[CurrentRowIndex].Cells["pib_brand"].Value.ToString();
                 LogicHandler.GetTimeFromDatecode(DateCode, pr_brand, out year, out month, out day, out date);
                 sql.Append(",pib_datecode='" + DateCode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' ");
             }
@@ -1340,6 +1340,10 @@ namespace UAS_LabelMachine
                         return;
                     }
                 }
+                else
+                {
+                    end = LabelInf.Rows.Count - 1;
+                }
                 MidBoxArgument.Clear();
                 List<int> MidOutBoxCode = new List<int>();
                 List<int> MidOutBoxCodeIndex = new List<int>();
@@ -1590,15 +1594,31 @@ namespace UAS_LabelMachine
             LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             //查询本地数据库
             sql.Clear();
-            sql.Append("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' limit 0,1 ");
+            sql.Append("select count(1) from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "'");
             DataTable dt = (DataTable)sdh.ExecuteSql(sql.ToString(), "select");
+            int rowcount = int.Parse(dt.Rows[0][0].ToString());
             //如果本地没有缓存过
-            if (dt.Rows.Count == 0)
+            if (rowcount == 0 || rowcount != LabelInfDataTable.Rows.Count)
             {
-                //检验查询的字段和本地数据库字段是否匹配
-                sdh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
-                //将数据保存在本地数据库
-                sdh.SaveDataTable(LabelInfDataTable, "prodiobarcode");
+                if (rowcount != LabelInfDataTable.Rows.Count && rowcount != 0)
+                {
+                    string close = MessageBox.Show(this.ParentForm, "本地条码和服务器条码数量不一致,覆盖本地条码", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                    if (close == "Yes")
+                    {
+                        sdh.ExecuteSql("delete from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "'", "delete");
+                        //检验查询的字段和本地数据库字段是否匹配
+                        sdh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
+                        //将数据保存在本地数据库
+                        sdh.SaveDataTable(LabelInfDataTable, "prodiobarcode");
+                    }
+                }
+                else
+                {
+                    //检验查询的字段和本地数据库字段是否匹配
+                    sdh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
+                    //将数据保存在本地数据库
+                    sdh.SaveDataTable(LabelInfDataTable, "prodiobarcode");
+                }
             }
             else if (LabelInfDataTable.Columns.Count != dt.Columns.Count)
             {
@@ -1614,7 +1634,7 @@ namespace UAS_LabelMachine
             TotalCount.Text = LabelInf.RowCount.ToString();
             if (LabelInf.RowCount > 0)
             {
-                Brand = LabelInf.Rows[0].Cells["pr_brand"].FormattedValue.ToString();
+                Brand = LabelInf.Rows[0].Cells["pib_brand"].FormattedValue.ToString();
                 if (Brand != "")
                     sg_code.Text = dh.getFieldDataByCondition("scangroup", "sg_code", "sg_brand='" + Brand + "'").ToString();
                 SetOutBoxCapacity(LabelInf.Rows[0].Cells["pib_prodcode"].Value.ToString());
@@ -2034,31 +2054,36 @@ namespace UAS_LabelMachine
 
         private void LabelInf_CellEndEdit(object sender, DataGridViewCellEventArgs e)
         {
-            StringBuilder pibid = new StringBuilder();
-            string madein = LabelInf.Rows[e.RowIndex].Cells["pib_madein"].Value.ToString();
-            if (LabelInf.Columns[e.ColumnIndex].Name == "pib_madein" && CollectionUnit.Text == "盒")
+            if (e.RowIndex > 0)
             {
-
-                string midbox = LabelInf.Rows[e.RowIndex].Cells["pib_outboxcode1"].Value.ToString();
-                for (int i = 0; i < LabelInf.Rows.Count; i++)
+                if (LabelInf.Columns[e.ColumnIndex].Name == "pin_madein")
                 {
-                    if (midbox == LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())
+                    StringBuilder pibid = new StringBuilder();
+                    string madein = LabelInf.Rows[e.RowIndex].Cells["pib_madein"].Value.ToString();
+                    if (LabelInf.Columns[e.ColumnIndex].Name == "pib_madein" && CollectionUnit.Text == "盒")
                     {
-                        LabelInf.Rows[i].Cells["pib_madein"].Value = madein;
-                        pibid.Append(LabelInf.Rows[i].Cells["pib_id1"].Value + ",");
+                        string midbox = LabelInf.Rows[e.RowIndex].Cells["pib_outboxcode1"].Value.ToString();
+                        for (int i = 0; i < LabelInf.Rows.Count; i++)
+                        {
+                            if (midbox == LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())
+                            {
+                                LabelInf.Rows[i].Cells["pib_madein"].Value = madein;
+                                pibid.Append(LabelInf.Rows[i].Cells["pib_id1"].Value + ",");
+                            }
+                        }
                     }
+                    if (LabelInf.Columns[e.ColumnIndex].Name == "pib_madein" && CollectionUnit.Text == "全部")
+                    {
+                        for (int i = 0; i < LabelInf.Rows.Count; i++)
+                        {
+                            LabelInf.Rows[i].Cells["pib_madein"].Value = madein;
+                            pibid.Append(LabelInf.Rows[i].Cells["pib_id1"].Value + ",");
+                        }
+                    }
+                    pibid.Append("1");
+                    sdh.ExecuteSql("update prodiobarcode set pib_madein='" + madein + "' where pib_id in (" + pibid + ")", "update");
                 }
             }
-            if (LabelInf.Columns[e.ColumnIndex].Name == "pib_madein" && CollectionUnit.Text == "全部")
-            {
-                for (int i = 0; i < LabelInf.Rows.Count; i++)
-                {
-                    LabelInf.Rows[i].Cells["pib_madein"].Value = madein;
-                    pibid.Append(LabelInf.Rows[i].Cells["pib_id1"].Value + ",");
-                }
-            }
-            pibid.Append("1");
-            sdh.ExecuteSql("update prodiobarcode set pib_madein='" + madein + "' where pib_id in (" + pibid + ")", "update");
         }
 
         private void ExportData_Click(object sender, EventArgs e)
@@ -2308,7 +2333,7 @@ namespace UAS_LabelMachine
                 case "流水调整":
                     if (cu_code.Text != "")
                     {
-                        ReSetMaxNum reset = new ReSetMaxNum(cu_code.Text);
+                        ReSetMaxNum reset = new ReSetMaxNum(cu_code.Text, pi_inoutno.Text);
                         BaseUtil.SetFormCenter(reset);
                         reset.ShowDialog();
                     }
@@ -2463,18 +2488,16 @@ namespace UAS_LabelMachine
             {
                 GetCustRule();
                 //获取最大的流水号
-
                 DataTable dt = ExcelHandler.ExcelToDataTable(ImportExcel.FileName, true);
                 if (dt == null)
                 {
                     MessageBox.Show("文件" + ImportExcel.FileName + "被占用或者格式不正确");
                     return;
                 }
+                string outsql = "";
+                LogicHandler.GenerateBarCode(PI_ID, cu_code.Text, out outsql);
                 sql.Clear();
-                sql.Append("select pr_spec,pd_outqty-nvl(sum(pib_qty),0) pd_outqty,pr_id,pd_piclass,pd_piid,pd_id,pr_zxbzs,pr_brand,pd_pdno,");
-                sql.Append("pd_prodcode,pd_ordercode,pd_orderdetno from prodiodetail left join product on pd_prodcode=pr_code left join prodiobarcode  ");
-                sql.Append("on pd_id=pib_pdid  where pd_inoutno='" + pi_inoutno.Text + "' group by pr_spec,pd_outqty,");
-                sql.Append("pr_id,pd_piclass,pd_piid,pd_id,pr_zxbzs,pr_brand,pd_pdno,pd_id,pd_prodcode,pd_ordercode,pd_orderdetno order by pd_pdno");
+                sql.Append(outsql);
                 DataTable dt1 = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 //需要插入的参数
                 ArrayList<string> barcode = new ArrayList<string>();
@@ -2490,6 +2513,8 @@ namespace UAS_LabelMachine
                 ArrayList<string> prbrand = new ArrayList<string>();
                 ArrayList<string> pdprodcode = new ArrayList<string>();
                 ArrayList<string> pib_custoutboxcode = new ArrayList<string>();
+                ArrayList<string> brand = new ArrayList<string>();
+                ArrayList<string> madein = new ArrayList<string>();
                 //用于数量的校验
                 Dictionary<string, decimal> sumqty = new Dictionary<string, decimal>();
                 Dictionary<string, Dictionary<string, decimal>> outsumqty = new Dictionary<string, Dictionary<string, decimal>>();
@@ -2530,6 +2555,8 @@ namespace UAS_LabelMachine
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     string pr_spec = dt.Rows[i]["规格型号"].ToString().Trim();
+                    string 品牌 = dt.Rows[i]["品牌"].ToString().Trim();
+                    string 产地 = dt.Rows[i]["产地"].ToString().Trim();
                     if (pr_spec.Trim() == "")
                     {
                         break;
@@ -2581,6 +2608,7 @@ namespace UAS_LabelMachine
                         string pd_id = dr[k]["pd_id"].ToString();
                         string pd_piclass = dr[k]["pd_piclass"].ToString();
                         string pr_id = dr[k]["pr_id"].ToString();
+                        string pr_madein = dr[k]["pr_madein"].ToString();
                         //已导入数量
                         decimal zxbzs = decimal.Parse(dr[k]["pr_zxbzs"].ToString());
                         decimal pd_outqty = 0;
@@ -2618,7 +2646,8 @@ namespace UAS_LabelMachine
                                 pdorderdetno.Add(pd_orderdetno);
                                 pdpdno.Add(pd_pdno);
                                 pdid.Add(pd_id);
-                                prbrand.Add(pr_brand);
+                                prbrand.Add(品牌 == "" ? pr_brand : 品牌);
+                                madein.Add(产地 == "" ? pr_madein : 产地);
                                 pdprodcode.Add(pd_prodcode);
                             }
                             custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
@@ -2632,7 +2661,8 @@ namespace UAS_LabelMachine
                             pdorderdetno.Add(pd_orderdetno);
                             pdpdno.Add(pd_pdno);
                             pdid.Add(pd_id);
-                            prbrand.Add(pr_brand);
+                            prbrand.Add(品牌 == "" ? pr_brand : 品牌);
+                            madein.Add(产地 == "" ? pr_madein : 产地);
                             pdprodcode.Add(pd_prodcode);
                         }
                         else
@@ -2651,7 +2681,8 @@ namespace UAS_LabelMachine
                                 pdorderdetno.Add(pd_orderdetno);
                                 pdpdno.Add(pd_pdno);
                                 pdid.Add(pd_id);
-                                prbrand.Add(pr_brand);
+                                prbrand.Add(品牌 == "" ? pr_brand : 品牌);
+                                madein.Add(产地 == "" ? pr_madein : 产地);
                                 pdprodcode.Add(pd_prodcode);
                             }
                         }
@@ -2707,10 +2738,10 @@ namespace UAS_LabelMachine
                         sql.Clear();
                         sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,pib_inman,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_PDNO,");
                         sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,pib_datecode,pib_lotno,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,pib_orderdetno,");
-                        sql.Append("pib_outboxcode2,pib_custbarcode,pib_custoutboxcode)values(prodiobarcode_seq.nextval,:pd_prodcode,'" + User.UserName + "',sysdate,");
+                        sql.Append("pib_outboxcode2,pib_custbarcode,pib_custoutboxcode,pib_madein)values(prodiobarcode_seq.nextval,:pd_prodcode,'" + User.UserName + "',sysdate,");
                         sql.Append("'" + pi_inoutno.Text + "'," + PI_ID + ",:pr_brand,:barcode,:pd_pdno,:pd_id,'" + pi_class.Text + "',:pib_inqty,");
-                        sql.Append(":pib_datecode,:pib_lotno,0,-1,:pd_ordercode,:pd_orderdetno,:outboxcode,:custbarcode,:pib_custoutboxcode)");
-                        dh.BatchInsert(sql.ToString(), new string[] { "pd_prodcode", "pr_brand", "barcode", "pd_pdno", "pd_id", "pib_inqty", "pib_datecode", "pib_lotno", "pd_ordercode", "pd_orderdetno", "outboxcode", "custbarcode", "pib_custoutboxcode" }, pdprodcode.ToArray(), prbrand.ToArray(), barcode.ToArray(), pdpdno.ToArray(), pdid.ToArray(), pib_inqty.ToArray(), datecode.ToArray(), lotno.ToArray(), pdordercode.ToArray(), pdorderdetno.ToArray(), piboutboxcode2.ToArray(), custbarcode.ToArray(), custoutboxcode.ToArray());
+                        sql.Append(":pib_datecode,:pib_lotno,0,-1,:pd_ordercode,:pd_orderdetno,:outboxcode,:custbarcode,:pib_custoutboxcode,:pib_madein)");
+                        dh.BatchInsert(sql.ToString(), new string[] { "pd_prodcode", "pr_brand", "barcode", "pd_pdno", "pd_id", "pib_inqty", "pib_datecode", "pib_lotno", "pd_ordercode", "pd_orderdetno", "outboxcode", "custbarcode", "pib_custoutboxcode", "pib_madein" }, pdprodcode.ToArray(), prbrand.ToArray(), barcode.ToArray(), pdpdno.ToArray(), pdid.ToArray(), pib_inqty.ToArray(), datecode.ToArray(), lotno.ToArray(), pdordercode.ToArray(), pdorderdetno.ToArray(), piboutboxcode2.ToArray(), custbarcode.ToArray(), custoutboxcode.ToArray(), madein.ToArray());
                         //更新流水
                         dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
                         LoadGridData();
@@ -2750,7 +2781,7 @@ namespace UAS_LabelMachine
         {
             Button setvalue = sender as Button;
             string pdno = LabelInf.Rows[rowindex].Cells["pib_pdno"].Value.ToString();
-            string pr_brand = LabelInf.Rows[rowindex].Cells["pr_brand"].Value.ToString();
+            string pr_brand = LabelInf.Rows[rowindex].Cells["pib_brand"].Value.ToString();
             string datecode = setvalue.FindForm().Controls["datecode"].Text;
             string lotno = setvalue.FindForm().Controls["lotno"].Text;
             string nums = setvalue.FindForm().Controls["Nums"].Text;
@@ -2785,7 +2816,7 @@ namespace UAS_LabelMachine
         {
             Button setvalueandprint = sender as Button;
             string pdno = LabelInf.Rows[rowindex].Cells["pib_pdno"].Value.ToString();
-            string pr_brand = LabelInf.Rows[rowindex].Cells["pr_brand"].Value.ToString();
+            string pr_brand = LabelInf.Rows[rowindex].Cells["pib_brand"].Value.ToString();
             string datecode = setvalueandprint.FindForm().Controls["datecode"].Text;
             string lotno = setvalueandprint.FindForm().Controls["lotno"].Text;
             string nums = setvalueandprint.FindForm().Controls["Nums"].Text;

+ 11 - 10
UAS-出货标签管理(贸易版)/生成条码.cs

@@ -220,18 +220,19 @@ namespace UAS_LabelMachine
                     ArrayList<string> midcode = new ArrayList<string>();
                     ArrayList<string> barcode = new ArrayList<string>();
                     ArrayList<string> custbarcode = new ArrayList<string>();
-                    int restqty1 = 0;
+                    decimal restqty1 = 0;
                     if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value != null && ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "")
                     {
                         string[] restqty = ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString().Split(',');
                         for (int k = 0; k < restqty.Length; k++)
                         {
                             string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+1", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
-                            int.TryParse(restqty[k], out restqty1);
+                            decimal.TryParse(restqty[k], out restqty1);
                             barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
                             custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
                             midcode.Add(mid_code);
                             pib_inqty.Add(restqty1.ToString());
+                            //剩余生成的数量需要减掉尾数
                         }
                     }
                     //循环中盒号的个数,取当前出入库单最大 的中盒号+1
@@ -408,19 +409,19 @@ namespace UAS_LabelMachine
             object pd_qty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_qty"].Value;
             object mid_qty = ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_qty"].Value;
             object pd_totalqty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_totalqty"].Value;
-            int restqty1 = 0;
+            decimal restqty1 = 0;
             if (ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value != null && ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value.ToString() != "")
             {
                 string[] restqty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value.ToString().Split(',');
                 for (int k = 0; k < restqty.Length; k++)
                 {
-                    int qty = 0;
-                    int.TryParse(restqty[k], out qty);
+                    decimal qty = 0;
+                    decimal.TryParse(restqty[k], out qty);
                     restqty1 += qty;
                 }
             }
-            ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_qty"].Value = decimal.Parse(pd_totalqty.ToString()) - restqty1;
-            pd_qty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_qty"].Value;
+            //ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_qty"].Value = decimal.Parse(pd_qty.ToString()) - restqty1;
+            pd_qty = decimal.Parse(pd_qty.ToString()) - restqty1;
             if (pr_zxbzs != null && pd_qty != null && mid_qty != null)
             {
                 decimal 最小包装量 = decimal.Parse(pr_zxbzs.ToString());
@@ -449,14 +450,14 @@ namespace UAS_LabelMachine
             for (int i = 0; i < ProdIoInfDGV.Rows.Count; i++)
             {
                 ProdIoInfDGV.Rows[i].Cells["mid_qty"].Value = MidCapacity.Text;
-                int restqty1 = 0;
+                decimal restqty1 = 0;
                 if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value != null && ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "")
                 {
                     string[] restqty = ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString().Split(',');
                     for (int k = 0; k < restqty.Length; k++)
                     {
-                        int qty = 0;
-                        int.TryParse(restqty[k], out qty);
+                        decimal qty = 0;
+                        decimal.TryParse(restqty[k], out qty);
                         restqty1 += qty;
                     }
                 }

+ 116 - 0
UAS-出货标签管理/PublicMethod/Analysis.cs

@@ -0,0 +1,116 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace UAS_LabelMachine.PublicMethod
+{
+    class Analysis
+    {
+        /// <summary>
+        /// Brand对应品牌,item对应DateCode,LotNo等,Data对应具体解析的数据
+        /// </summary>
+        /// <param name="Brand"></param>
+        /// <param name="item"></param>
+        /// <param name="Data"></param>
+        /// <returns></returns>
+        //Brand对应品牌,item对应DateCode,LotNo等,Data对应具体解析的数据
+        public static string AnalysisData(string Brand, string item, string Data)
+        {
+            string ReturnData = "";
+            switch (Brand)
+            {
+                //采集怡海能达村田的LotNo的解析规则
+                case "MURATA":
+                    if (item.ToUpper() == "LOTNO" || item.ToUpper() == "DATECODE")
+                    {
+                        string Year = Data.Substring(2, 1);
+                        string Month = Data.Substring(3, 1);
+                        string Day = Data.Substring(4, 2);
+                        //处理年份
+                        //当前年份的前三位
+                        string CurrentYear_3 = DateTime.Now.Year.ToString().Substring(0, 3);
+                        //采集到的年份
+                        int CollectYear = int.Parse(CurrentYear_3 + Year);
+                        //当前的年份 
+                        int CurrentYear = int.Parse(DateTime.Now.Year.ToString());
+                        //如果采集到的年份大于当前年份,将十年数-1
+                        if (CollectYear > CurrentYear)
+                        {
+                            Year = int.Parse(CurrentYear_3) - 1 + Year;
+                        }
+                        else
+                        {
+                            Year = CollectYear.ToString();
+                        }
+                        //处理月份
+                        switch (Month)
+                        {
+                            case "O":
+                                Month = "10";
+                                break;
+                            case "N":
+                                Month = "11";
+                                break;
+                            case "D":
+                                Month = "12";
+                                break;
+                            default:
+                                Month = "0" + Month;
+                                break;
+                        }
+                        ReturnData = Year + Month + Day;
+                    }
+                    break;
+                case "KEC":
+                    if (item.ToUpper() == "LOTNO" || item.ToUpper() == "DATECODE")
+                    {
+                        string Year = Data.Substring(0, 1);
+                        string Week = Data.Substring(1, 2);
+                        DateTime DateBegin = DateTime.Now;
+                        GetDaysOfWeeks(int.Parse("201" + Year), int.Parse(Week), out DateBegin);
+                        ReturnData = DateBegin.ToString("yyyyMMdd");
+                    }
+                    break;
+                default:
+                    break;
+            }
+            return ReturnData;
+        }
+
+        public static bool GetDaysOfWeeks(int year, int index, out DateTime first)
+        {
+            first = DateTime.MinValue;
+            if (year < 1700 || year > 9999)
+            {
+                //"年份超限"
+                return false;
+            }
+            if (index < 1 || index > 53)
+            {
+                //"周数错误"
+                return false;
+            }
+            DateTime startDay = new DateTime(year, 1, 1);  //该年第一天
+            DateTime endDay = new DateTime(year + 1, 1, 1).AddMilliseconds(-1);
+            int dayOfWeek = 0;
+            if (Convert.ToInt32(startDay.DayOfWeek.ToString("d")) > 0)
+                dayOfWeek = Convert.ToInt32(startDay.DayOfWeek.ToString("d"));  //该年第一天为星期几
+            if (dayOfWeek == 7) { dayOfWeek = 0; }
+            if (index == 1)
+            {
+                first = startDay;
+            }
+            else
+            {
+                first = startDay.AddDays((7 - dayOfWeek) + (index - 1) * 7); //index周的起始日期
+            }
+            if (first > endDay)  //startDayOfWeeks不在该年范围内
+            {
+                //"输入周数大于本年最大周数";
+                return false;
+            }
+            return true;
+        }
+    }
+}

+ 22 - 22
UAS-出货标签管理/PublicMethod/DataHelper.cs

@@ -11,17 +11,17 @@ namespace UAS_LabelMachine
     public class DataHelper
     {
 
-        //富为外网地址
-        private readonly string ConnectionStrings = "Data Source=richwellgroup.com.cn/orcl;User ID=DATACENTER;PassWord=select!#%*(";
-        private readonly string InnerConnectionStrings = "Data Source=richwellgroup.com.cn/orcl;User ID=DATACENTER;PassWord=select!#%*(";
-        //富为ERP地址
-        public static readonly string ERPAddesss = "http://richwellgroup.com.cn:8099/ERP/";
-        //富为FTP
-        public static readonly string FTPAdress = "ftp://richwellgroup.com.cn|printuser|printuser";
-        //Oracle端口
-        public static readonly string OraclePort = "1521";
-        //需要显示的账套
-        public static readonly string Masters = "JDTSY,FW_JDT,N_DATACENTER,FY_TEST,JD_TEST,XY_TEST,FW_TEST,DATACENTER,FW,XY,FY";
+        ////富为外网地址
+        //private readonly string ConnectionStrings = "Data Source=richwellgroup.com.cn/orcl;User ID=DATACENTER;PassWord=select!#%*(";
+        //private readonly string InnerConnectionStrings = "Data Source=richwellgroup.com.cn/orcl;User ID=DATACENTER;PassWord=select!#%*(";
+        ////富为ERP地址
+        //public static readonly string ERPAddesss = "http://richwellgroup.com.cn:8099/ERP/";
+        ////富为FTP
+        //public static readonly string FTPAdress = "ftp://richwellgroup.com.cn|printuser|printuser";
+        ////Oracle端口
+        //public static readonly string OraclePort = "1521";
+        ////需要显示的账套
+        //public static readonly string Masters = "JDTSY,FW_JDT,N_DATACENTER,FY_TEST,JD_TEST,XY_TEST,FW_TEST,DATACENTER,FW,XY,FY";
 
         ////高登地址
         //private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=183.238.39.179)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
@@ -35,19 +35,19 @@ namespace UAS_LabelMachine
         ////需要显示的账套
         //public static readonly string Masters = "GOLDEN";
 
-        //////怡海能达外网地址
-        //private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=sz.hi-mantech.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        ////怡海能达外网地址
+        private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=sz.hi-mantech.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
-        //private readonly string InnerConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.200)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        private readonly string InnerConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.200)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
-        ////怡海能达ERP地址
-        //public static readonly string ERPAddesss = "http://sz.hi-mantech.com:8099/ERP/";
-        ////怡海能达FTP
-        //public static readonly string FTPAdress = "ftp://sz.hi-mantech.com:46688|yhndftp|Stga28ytG8";
-        ////Oracle端口
-        //public static readonly string OraclePort = "1521";
-        ////需要显示的账套
-        //public static readonly string Masters = "YHND_SZ,YHND_HK,DATACENTER,YITOA_ZX,T_YHND_HK";
+        //怡海能达ERP地址
+        public static readonly string ERPAddesss = "http://sz.hi-mantech.com:8099/ERP/";
+        //怡海能达FTP
+        public static readonly string FTPAdress = "ftp://sz.hi-mantech.com:46688|yhndftp|Stga28ytG8";
+        //Oracle端口
+        public static readonly string OraclePort = "1521";
+        //需要显示的账套
+        public static readonly string Masters = "YHND_SZ,YHND_HK,DATACENTER,YITOA_ZX,T_YHND_HK";
 
         ////华商龙外网地址
         //private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=YITOA_DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=218.18.115.198)(PORT=1523)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";

+ 1 - 3
UAS-出货标签管理/UAS-出货标签管理.csproj

@@ -97,9 +97,6 @@
     <ApplicationIcon>Resources\print_128px_1082624_easyicon.net.ico</ApplicationIcon>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Analysis">
-      <HintPath>tool\Analysis.dll</HintPath>
-    </Reference>
     <Reference Include="Interop.LabelManager2">
       <HintPath>..\..\..\UAS_WinForm\UAS-出货标签管理\bin\Debug\Interop.LabelManager2.dll</HintPath>
       <EmbedInteropTypes>False</EmbedInteropTypes>
@@ -237,6 +234,7 @@
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
       <DependentUpon>Settings.settings</DependentUpon>
     </Compile>
+    <Compile Include="PublicMethod\Analysis.cs" />
     <Compile Include="PublicMethod\ArrayList.cs" />
     <Compile Include="PublicMethod\AutoSizeFormClass.cs" />
     <Compile Include="PublicMethod\BaseUtil.cs" />

+ 6 - 7
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -10,7 +10,6 @@ using System.Diagnostics;
 using LabelManager2;
 using UAS_LabelMachine.PublicMethod;
 using UAS_LabelMachine.Entity;
-using UAS_特殊解析规则;
 using UAS_LabelMachine.PublicForm;
 using System.Threading;
 using System.IO;
@@ -2343,7 +2342,7 @@ namespace UAS_LabelMachine
                     }
                 }
             }
-            SaveGrid_Click(sender, e);
+            SaveGrid_Click(sender, e); 
         }
 
         private void LogingOut_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@@ -2495,16 +2494,19 @@ namespace UAS_LabelMachine
                             string custbarcode = LabelInf.Rows[i].Cells["pib_cusbarcode"].Value.ToString();
                             //通过接口维护料盘和外箱关系,需要根据箱内容量计算
                             //判断下一行箱号不一样重新取一个客户外箱号
-                            if (i - 1 > 0)
+                            if (i +1 < LabelInf.Rows.Count)
                             {
                                 string CurrentOutBoxCode = LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString();
-                                string NextOutBoxCode = LabelInf.Rows[i - 1].Cells["pib_outboxcode2"].Value.ToString();
+                                string NextOutBoxCode = LabelInf.Rows[i + 1].Cells["pib_outboxcode2"].Value.ToString();
                                 if (CurrentOutBoxCode != NextOutBoxCode)
                                 {
                                     NextBoxDiff = true;
                                     InBoxCount = OutboxCapacity.Value - 1;
                                 }
                             }
+                            InBoxCount = InBoxCount + 1;
+                            amount += double.Parse(LabelInf.Rows[i].Cells["pib_qty"].Value.ToString());
+                            Rowindex.Add(i);
                             if (NextBoxDiff)
                             {
                                 //换箱号时
@@ -2526,9 +2528,6 @@ namespace UAS_LabelMachine
                                     MessageLog.AppendText(BaseUtil.ToDictionary(Message, "")["return_message"].ToString() + "\n");
                                 }
                             }
-                            InBoxCount = InBoxCount + 1;
-                            amount += double.Parse(LabelInf.Rows[i].Cells["pib_qty"].Value.ToString());
-                            Rowindex.Add(i);
                             //达到容量时
                             if (InBoxCount == OutboxCapacity.Value)
                             {