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

Merge branch 'master' of ssh://pscg.dongkesoft.com:9003/mes/hg5020

chenxy 6 лет назад
Родитель
Сommit
3cdf8224e0

+ 29 - 25
DK.Client/PCModule/F_PC_0104_1.Designer.cs

@@ -140,7 +140,7 @@
             this.GroutingLineNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.MouldQuantity = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.GMouldTypeName = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.HIGHPRESSUREFLAG = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.HIGHPRESSUREFLAG = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.monitorcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.UserCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.staffCodeList = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -352,7 +352,7 @@
             this.dgvGroutingLine.IsSubTotalFlag = false;
             this.dgvGroutingLine.IsTopDeep = false;
             this.dgvGroutingLine.Location = new System.Drawing.Point(0, 0);
-            this.dgvGroutingLine.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.dgvGroutingLine.Margin = new System.Windows.Forms.Padding(4);
             this.dgvGroutingLine.MergeColumnNames = null;
             this.dgvGroutingLine.MergeDetailColumnNames = null;
             this.dgvGroutingLine.MergeDetailOnlyColumn = null;
@@ -416,7 +416,7 @@
             this.txtEndUsedDateEnd.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtEndUsedDateEnd.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
             this.txtEndUsedDateEnd.Location = new System.Drawing.Point(1071, 59);
-            this.txtEndUsedDateEnd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtEndUsedDateEnd.Margin = new System.Windows.Forms.Padding(4);
             this.txtEndUsedDateEnd.Name = "txtEndUsedDateEnd";
             this.txtEndUsedDateEnd.Size = new System.Drawing.Size(139, 25);
             this.txtEndUsedDateEnd.TabIndex = 18;
@@ -440,7 +440,7 @@
             this.txtEndUsedDateStart.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtEndUsedDateStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
             this.txtEndUsedDateStart.Location = new System.Drawing.Point(895, 59);
-            this.txtEndUsedDateStart.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtEndUsedDateStart.Margin = new System.Windows.Forms.Padding(4);
             this.txtEndUsedDateStart.Name = "txtEndUsedDateStart";
             this.txtEndUsedDateStart.Size = new System.Drawing.Size(136, 25);
             this.txtEndUsedDateStart.TabIndex = 16;
@@ -450,7 +450,7 @@
             this.cbEndTime.AutoSize = true;
             this.cbEndTime.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.cbEndTime.Location = new System.Drawing.Point(795, 61);
-            this.cbEndTime.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.cbEndTime.Margin = new System.Windows.Forms.Padding(4);
             this.cbEndTime.Name = "cbEndTime";
             this.cbEndTime.Size = new System.Drawing.Size(89, 19);
             this.cbEndTime.TabIndex = 15;
@@ -465,7 +465,7 @@
             this.txtRemarks.ErrorMessage = "";
             this.txtRemarks.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtRemarks.Location = new System.Drawing.Point(103, 92);
-            this.txtRemarks.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtRemarks.Margin = new System.Windows.Forms.Padding(4);
             this.txtRemarks.MaxLength = 500;
             this.txtRemarks.Name = "txtRemarks";
             this.txtRemarks.Size = new System.Drawing.Size(421, 25);
@@ -490,7 +490,7 @@
             this.txtBeginUsedDateEnd.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtBeginUsedDateEnd.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
             this.txtBeginUsedDateEnd.Location = new System.Drawing.Point(1071, 25);
-            this.txtBeginUsedDateEnd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtBeginUsedDateEnd.Margin = new System.Windows.Forms.Padding(4);
             this.txtBeginUsedDateEnd.Name = "txtBeginUsedDateEnd";
             this.txtBeginUsedDateEnd.Size = new System.Drawing.Size(139, 25);
             this.txtBeginUsedDateEnd.TabIndex = 9;
@@ -514,7 +514,7 @@
             this.txtBeginUsedDateStart.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtBeginUsedDateStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
             this.txtBeginUsedDateStart.Location = new System.Drawing.Point(895, 25);
-            this.txtBeginUsedDateStart.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtBeginUsedDateStart.Margin = new System.Windows.Forms.Padding(4);
             this.txtBeginUsedDateStart.Name = "txtBeginUsedDateStart";
             this.txtBeginUsedDateStart.Size = new System.Drawing.Size(136, 25);
             this.txtBeginUsedDateStart.TabIndex = 7;
@@ -524,7 +524,7 @@
             this.cbStartTime.AutoSize = true;
             this.cbStartTime.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.cbStartTime.Location = new System.Drawing.Point(795, 28);
-            this.cbStartTime.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.cbStartTime.Margin = new System.Windows.Forms.Padding(4);
             this.cbStartTime.Name = "cbStartTime";
             this.cbStartTime.Size = new System.Drawing.Size(89, 19);
             this.cbStartTime.TabIndex = 6;
@@ -539,7 +539,7 @@
             this.txtGroutingLineName.ErrorMessage = "";
             this.txtGroutingLineName.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtGroutingLineName.Location = new System.Drawing.Point(365, 59);
-            this.txtGroutingLineName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtGroutingLineName.Margin = new System.Windows.Forms.Padding(4);
             this.txtGroutingLineName.MaxLength = 50;
             this.txtGroutingLineName.Name = "txtGroutingLineName";
             this.txtGroutingLineName.Size = new System.Drawing.Size(159, 25);
@@ -567,7 +567,7 @@
             this.txtGroutingLineCode.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtGroutingLineCode.ImeMode = System.Windows.Forms.ImeMode.Off;
             this.txtGroutingLineCode.Location = new System.Drawing.Point(103, 59);
-            this.txtGroutingLineCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtGroutingLineCode.Margin = new System.Windows.Forms.Padding(4);
             this.txtGroutingLineCode.MaxLength = 30;
             this.txtGroutingLineCode.Name = "txtGroutingLineCode";
             this.txtGroutingLineCode.RejectCharsPattern = "[^a-zA-Z0-9]";
@@ -609,7 +609,7 @@
             this.txtGroutingLineNo.ErrorMessage = "";
             this.txtGroutingLineNo.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtGroutingLineNo.Location = new System.Drawing.Point(628, 25);
-            this.txtGroutingLineNo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtGroutingLineNo.Margin = new System.Windows.Forms.Padding(4);
             this.txtGroutingLineNo.MaxLength = 10;
             this.txtGroutingLineNo.Name = "txtGroutingLineNo";
             this.txtGroutingLineNo.Size = new System.Drawing.Size(159, 25);
@@ -649,7 +649,7 @@
             this.txtBuildingNo.ErrorMessage = "";
             this.txtBuildingNo.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtBuildingNo.Location = new System.Drawing.Point(103, 25);
-            this.txtBuildingNo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtBuildingNo.Margin = new System.Windows.Forms.Padding(4);
             this.txtBuildingNo.MaxLength = 10;
             this.txtBuildingNo.Name = "txtBuildingNo";
             this.txtBuildingNo.Size = new System.Drawing.Size(159, 25);
@@ -708,10 +708,10 @@
             this.gbxCondition.ForeColor = System.Drawing.SystemColors.ControlText;
             this.gbxCondition.IsMustInput = false;
             this.gbxCondition.Location = new System.Drawing.Point(0, 48);
-            this.gbxCondition.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.gbxCondition.Margin = new System.Windows.Forms.Padding(4);
             this.gbxCondition.Name = "gbxCondition";
             this.gbxCondition.OriginalHeight = -1;
-            this.gbxCondition.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.gbxCondition.Padding = new System.Windows.Forms.Padding(4);
             this.gbxCondition.Size = new System.Drawing.Size(1559, 129);
             this.gbxCondition.TabIndex = 1;
             this.gbxCondition.TabStop = false;
@@ -734,7 +734,7 @@
             // 
             this.scbGMouldType.CheckedData = null;
             this.scbGMouldType.Location = new System.Drawing.Point(628, 59);
-            this.scbGMouldType.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.scbGMouldType.Margin = new System.Windows.Forms.Padding(4);
             this.scbGMouldType.Name = "scbGMouldType";
             this.scbGMouldType.Size = new System.Drawing.Size(161, 26);
             this.scbGMouldType.TabIndex = 29;
@@ -744,7 +744,7 @@
             this.chkDisable.AutoSize = true;
             this.chkDisable.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.chkDisable.Location = new System.Drawing.Point(1147, 95);
-            this.chkDisable.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.chkDisable.Margin = new System.Windows.Forms.Padding(4);
             this.chkDisable.Name = "chkDisable";
             this.chkDisable.Size = new System.Drawing.Size(59, 19);
             this.chkDisable.TabIndex = 26;
@@ -758,7 +758,7 @@
             this.chkEnable.CheckState = System.Windows.Forms.CheckState.Checked;
             this.chkEnable.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.chkEnable.Location = new System.Drawing.Point(1071, 95);
-            this.chkEnable.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.chkEnable.Margin = new System.Windows.Forms.Padding(4);
             this.chkEnable.Name = "chkEnable";
             this.chkEnable.Size = new System.Drawing.Size(59, 19);
             this.chkEnable.TabIndex = 25;
@@ -773,7 +773,7 @@
             this.lstcbxGMouldStatus.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.lstcbxGMouldStatus.FormattingEnabled = true;
             this.lstcbxGMouldStatus.Location = new System.Drawing.Point(628, 92);
-            this.lstcbxGMouldStatus.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.lstcbxGMouldStatus.Margin = new System.Windows.Forms.Padding(4);
             this.lstcbxGMouldStatus.Name = "lstcbxGMouldStatus";
             this.lstcbxGMouldStatus.Size = new System.Drawing.Size(160, 23);
             this.lstcbxGMouldStatus.TabIndex = 22;
@@ -787,7 +787,7 @@
             this.txtFloorNo.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtFloorNo.ImeMode = System.Windows.Forms.ImeMode.Off;
             this.txtFloorNo.Location = new System.Drawing.Point(365, 26);
-            this.txtFloorNo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtFloorNo.Margin = new System.Windows.Forms.Padding(4);
             this.txtFloorNo.MaxValue = new decimal(new int[] {
             99,
             0,
@@ -814,7 +814,7 @@
             this.txtGroutingUserCode.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtGroutingUserCode.ImeMode = System.Windows.Forms.ImeMode.Off;
             this.txtGroutingUserCode.Location = new System.Drawing.Point(876, 92);
-            this.txtGroutingUserCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.txtGroutingUserCode.Margin = new System.Windows.Forms.Padding(4);
             this.txtGroutingUserCode.MaxLength = 20;
             this.txtGroutingUserCode.Name = "txtGroutingUserCode";
             this.txtGroutingUserCode.RejectCharsPattern = "[^a-zA-Z0-9]";
@@ -901,7 +901,7 @@
             this.dgvGroutingLineDetail.IsSubTotalFlag = false;
             this.dgvGroutingLineDetail.IsTopDeep = false;
             this.dgvGroutingLineDetail.Location = new System.Drawing.Point(0, 0);
-            this.dgvGroutingLineDetail.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.dgvGroutingLineDetail.Margin = new System.Windows.Forms.Padding(4);
             this.dgvGroutingLineDetail.MergeColumnNames = null;
             this.dgvGroutingLineDetail.MergeDetailColumnNames = null;
             this.dgvGroutingLineDetail.MergeDetailOnlyColumn = null;
@@ -1097,7 +1097,7 @@
             | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
             this.splLine.Location = new System.Drawing.Point(0, 184);
-            this.splLine.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.splLine.Margin = new System.Windows.Forms.Padding(4);
             this.splLine.Name = "splLine";
             this.splLine.Orientation = System.Windows.Forms.Orientation.Horizontal;
             // 
@@ -1409,10 +1409,14 @@
             // HIGHPRESSUREFLAG
             // 
             this.HIGHPRESSUREFLAG.DataPropertyName = "HIGHPRESSUREFLAG";
+            this.HIGHPRESSUREFLAG.FalseValue = "0";
             this.HIGHPRESSUREFLAG.HeaderText = "高压注浆";
             this.HIGHPRESSUREFLAG.MinimumWidth = 6;
             this.HIGHPRESSUREFLAG.Name = "HIGHPRESSUREFLAG";
             this.HIGHPRESSUREFLAG.ReadOnly = true;
+            this.HIGHPRESSUREFLAG.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+            this.HIGHPRESSUREFLAG.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+            this.HIGHPRESSUREFLAG.TrueValue = "1";
             this.HIGHPRESSUREFLAG.Width = 125;
             // 
             // monitorcode
@@ -1523,7 +1527,7 @@
             this.Controls.Add(this.splLine);
             this.Controls.Add(this.gbxCondition);
             this.Controls.Add(this.tsrOperate);
-            this.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
+            this.Margin = new System.Windows.Forms.Padding(5);
             this.Name = "F_PC_0104_1";
             this.Text = "F_PC_0104";
             this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.F_PC_0104_FormClosed);
@@ -1639,7 +1643,7 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn GroutingLineNo;
         private System.Windows.Forms.DataGridViewTextBoxColumn MouldQuantity;
         private System.Windows.Forms.DataGridViewTextBoxColumn GMouldTypeName;
-        private System.Windows.Forms.DataGridViewTextBoxColumn HIGHPRESSUREFLAG;
+        private System.Windows.Forms.DataGridViewCheckBoxColumn HIGHPRESSUREFLAG;
         private System.Windows.Forms.DataGridViewTextBoxColumn monitorcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn UserCode;
         private System.Windows.Forms.DataGridViewTextBoxColumn staffCodeList;

+ 99 - 56
DK.Service/PDAModuleLogic/PDAModuleLogicWorkShop3.cs

@@ -332,7 +332,7 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
         }
 
         /// <summary>
-        /// 成型线模具查询方法 E37 2#0101 2019-08-12 应用于 注登记
+        /// 成型线模具查询方法 E37 2#0101 2019-08-12 应用于 注登记
         /// </summary>
         /// <param name="groutingLineCode"></param>
         /// <param name="groutingDay"></param>
@@ -353,6 +353,38 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                 {
                     AddServiceResultEntity(sre, GetGroutingLineInfo(groutingLineCode, groutingDay, sUser));
                 }
+                //校验注浆日期 允许多次注浆:>= 最后注浆日期 不允许多次 > 最后注浆日期 同时小于等于今天
+                if (sre.Status == Constant.ServiceResultStatus.Success)
+                {
+                    sqlStr = $@"
+                        SELECT
+	                        l.LASTGROUTINGDATE,
+	                        t.CANMANYTIMES 
+                        FROM
+	                        TP_PC_GROUTINGLINE l
+	                        LEFT JOIN TP_MST_GMOULDTYPE t ON l.GMOULDTYPEID = t.GMOULDTYPEID 
+                        WHERE
+	                        l.VALUEFLAG = '1'
+	                        AND l.ACCOUNTID = {sUser.AccountID} 
+                            AND l.GROUTINGLINECODE = '{groutingLineCode}'
+                    ";
+                    DataTable groutingLine = conn.GetSqlResultToDt(sqlStr);
+                    if (groutingLine.Rows.Count>0)
+                    {
+                        DateTime groutingDate = Convert.ToDateTime(groutingDay);
+                        DateTime lastGroutingDate = Convert.ToDateTime(groutingLine.Rows[0]["LASTGROUTINGDATE"].ToString());
+                        string canManyTimes = groutingLine.Rows[0]["CANMANYTIMES"].ToString();
+                        if (!(
+                            groutingDate >= lastGroutingDate && canManyTimes == "1" && groutingDate <= DateTime.Now.Date
+                            || groutingDate > lastGroutingDate && canManyTimes == "0" && groutingDate <= DateTime.Now.Date
+                            ))
+                        {
+                            sre.Status = Constant.ServiceResultStatus.Other;
+                            sre.OtherStatus = -1;
+                            sre.Message = "当前日期不允许注浆!";
+                        }
+                    }
+                }
                 //检查注浆限制天数 'S_PM_021'
                 if (sre.Status == Constant.ServiceResultStatus.Success)
                 {
@@ -635,7 +667,7 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
             string sqlStr = "";
             int result = -1;
             int classesSettingId = -1;
-            string groutingBatchNo = "";
+            string groutingBatchNoBegin = "";
             try
             {
                 conn.Connect();
@@ -648,9 +680,9 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                 //注浆批次处理 当注浆日期 等于 当前日期 时 注浆批次 为最后注浆批次 加1 处理
                 //当注浆日期 不等于 当前日期 时 注浆批数 从0开始 加1 处理
                 if (DateTime.Now.ToString("yyyy-MM-dd") == jsonL["GROUTINGDATE"].ToString())
-                    groutingBatchNo = "l.LASTGROUTINGBATCHNO";
+                    groutingBatchNoBegin = "l.LASTGROUTINGBATCHNO";
                 else
-                    groutingBatchNo = "0";
+                    groutingBatchNoBegin = "0";
 
                 //校验工号 成型线工号配置的工号 必须包含当前用户
                 if (sre.Status == Constant.ServiceResultStatus.Success)
@@ -824,7 +856,7 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                                 '{sUser.UserCode}',-- USERCODE
                                 l.GMOULDSTATUS,
                                 {classesSettingId}, -- 从 CLASSESSETTINGID 查询
-                                {groutingBatchNo} + {i} + 1, --LASTGROUTINGBATCHNO 批次号 每注一次加1
+                                {groutingBatchNoBegin} + {i} + 1, --LASTGROUTINGBATCHNO 批次号 每注一次加1
                                 l.MONITORID,
                                 m.USERCODE AS MONITORCODE, --MONITORCODE 关联 TP_MST_USER 查询
                                 l.HIGHPRESSUREFLAG
@@ -834,8 +866,8 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
 	                            LEFT JOIN TP_MST_USER m ON l.MONITORID = m.USERID
                             WHERE
 	                            GROUTINGLINECODE = '{jsonL["GROUTINGLINECODE"].ToString()}' --成型线号
-                             AND l.VALUEFLAG = '1'
-                             AND l.GMOULDSTATUS = 1
+                                AND l.VALUEFLAG = '1'
+                                AND l.GMOULDSTATUS = 1
                             ;";
 
                             //按成型线模具循环插入注浆记录明细 TP_PM_GROUTINGDAILYDETAIL
@@ -889,7 +921,7 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                                     '0',--DELIVERFLAG
                                     l.GMOULDTYPEID,--GMOULDTYPEID
                                     t.CANMANYTIMES,--CANMANYTIMES
-                                    {groutingBatchNo} + {i} + 1, --LASTGROUTINGBATCHNO 批次号 每注一次加1
+                                    {groutingBatchNoBegin} + {i} + 1, --LASTGROUTINGBATCHNO 批次号 每注一次加1
                                     o.LOGOID,--LOGOID
                                     NULL,--SCRAPTIME
                                     NULL,--SCRAPUSER
@@ -920,11 +952,11 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                                 SET 
                                     GROUTINGCOUNT = GROUTINGCOUNT + {jsonM[j]["GROUTINGFLAG"].ToString()}
                                 WHERE
-                                    d.ACCOUNTID = {sUser.AccountID}
-	                                AND d.VALUEFLAG = '1' 
-	                                AND d.GMOULDSTATUS = 1 
-	                                AND l.GROUTINGLINECODE = '{jsonL["GROUTINGLINECODE"].ToString()}' --成型线号
-                                    AND d.GROUTINGMOULDCODE = '{jsonM[j]["GROUTINGMOULDCODE"].ToString()}'
+                                    ACCOUNTID = {sUser.AccountID}
+	                                AND VALUEFLAG = '1' 
+	                                AND GMOULDSTATUS = 1 
+	                                --AND GROUTINGLINECODE = '{jsonL["GROUTINGLINECODE"].ToString()}' --成型线号
+                                    AND GROUTINGMOULDCODE = '{jsonM[j]["GROUTINGMOULDCODE"].ToString()}'
                                 ;";
 
                             }
@@ -954,7 +986,7 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                             TP_PC_GROUTINGLINE l
                         SET 
                             l.LASTGROUTINGDATE = DATE '{jsonL["GROUTINGDATE"].ToString()}',
-                            l.LASTGROUTINGBATCHNO = {groutingBatchNo} + {jsonL["GROUTINGTIMES"].ToString()}
+                            l.LASTGROUTINGBATCHNO = {groutingBatchNoBegin} + {jsonL["GROUTINGTIMES"].ToString()}
                         WHERE
                             l.GROUTINGLINECODE = '{jsonL["GROUTINGLINECODE"].ToString()}'
                         ";
@@ -1020,7 +1052,8 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
             try
             {
                 conn.Connect();
-                //更新注浆记录数据
+                //一定要先更新注浆次数 如果先更新的注浆记录 将无法分辨 注浆标识
+                //更新 成型线明细 注浆日报明细 注浆次数
                 if (sre.Status == Constant.ServiceResultStatus.Success && groutingData != "")
                 {
                     try
@@ -1028,26 +1061,46 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                         JArray json = JArray.Parse(groutingData);
                         string updateOne = $@"
                             UPDATE 
+                                TP_PC_GROUTINGLINEDETAIL
+                            SET 
+                                GROUTINGCOUNT = GROUTINGCOUNT + :GROUTINGCOUNT
+                            WHERE 
+                                GROUTINGLINEDETAILID = :GROUTINGLINEDETAILID
+                            ;
+                            UPDATE 
                                 TP_PM_GROUTINGDAILYDETAIL
-                            SET
-                                GROUTINGFLAG = ':GROUTINGFLAG',
-                                NOGROUTINGRREASON = :NOGROUTINGRREASON
-                            WHERE
+                            SET 
+                                GROUTINGCOUNT = GROUTINGCOUNT + :GROUTINGCOUNT
+                            WHERE 
                                 GROUTINGDAILYDETAILID = :GROUTINGDAILYDETAILID
                             ;
                             ";
                         sqlStr = "BEGIN";
-                        for (int i=0;i<json.Count;i++)
+                        DataTable dt = new DataTable();
+                        for (int i = 0; i < json.Count; i++)
                         {
-                            //验证注浆原因,如果没给数据,置为空
-                            if (!(json[i]["NOGROUTINGRREASON"] is object))
-                                json[i]["NOGROUTINGRREASON"] = "null";
+                            //读取原注浆记录进行比对,原来 注浆标识 为1 现在 注浆标识 为0 要-1  反之加1
+                            dt = conn.GetSqlResultToDt($@"
+                                SELECT  
+                                    GROUTINGDAILYDETAILID,
+                                    GROUTINGLINEDETAILID,
+                                    GROUTINGFLAG
+                                FROM
+                                    TP_PM_GROUTINGDAILYDETAIL
+                                WHERE
+                                    GROUTINGDAILYDETAILID = {json[i]["GROUTINGDAILYDETAILID"].ToString()}
+                            ");
+                            string groutingCount = "";
 
-                            sqlStr += updateOne
-                                .Replace(":GROUTINGFLAG", json[i]["GROUTINGFLAG"].ToString())
-                                .Replace(":NOGROUTINGRREASON", json[i]["NOGROUTINGRREASON"].ToString())
-                                .Replace(":GROUTINGDAILYDETAILID", json[i]["GROUTINGDAILYDETAILID"].ToString());
-                            //sqlStr += ";";
+                            //注浆标识改变 才更新 注浆次数
+                            if (json[i]["GROUTINGFLAG"].ToString() != dt.Rows[0]["GROUTINGFLAG"].ToString())
+                            {
+                                groutingCount = json[i]["GROUTINGFLAG"].ToString() == "1" ? "1" : "-1";
+                                sqlStr += updateOne
+                                    .Replace(":GROUTINGCOUNT", groutingCount)
+                                    .Replace(":GROUTINGLINEDETAILID", dt.Rows[0]["GROUTINGLINEDETAILID"].ToString())
+                                    .Replace(":GROUTINGDAILYDETAILID", dt.Rows[0]["GROUTINGDAILYDETAILID"].ToString());
+                            }
                         }
                         sqlStr += "END;";
                         result = conn.ExecuteNonQuery(sqlStr);
@@ -1057,10 +1110,10 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                     catch
                     {
                         sre.Status = Constant.ServiceResultStatus.NoSearchResults;
-                        sre.Message = "注浆记录保存失败!";
+                        sre.Message = "注浆次数更新失败!";
                     }
                 }
-                //更新成型线明细注浆次数
+                //更新注浆记录数据 不可以在更新 注浆次数 之前 执行
                 if (sre.Status == Constant.ServiceResultStatus.Success && groutingData != "")
                 {
                     try
@@ -1068,37 +1121,26 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                         JArray json = JArray.Parse(groutingData);
                         string updateOne = $@"
                             UPDATE 
-                                TP_PC_GROUTINGLINEDETAIL
-                            SET 
-                                GROUTINGCOUNT = GROUTINGCOUNT + :GROUTINGCOUNT
-                            WHERE 
-                                GROUTINGLINEDETAILID = :GROUTINGLINEDETAILID
+                                TP_PM_GROUTINGDAILYDETAIL
+                            SET
+                                GROUTINGFLAG = ':GROUTINGFLAG',
+                                NOGROUTINGRREASON = :NOGROUTINGRREASON
+                            WHERE
+                                GROUTINGDAILYDETAILID = :GROUTINGDAILYDETAILID
                             ;
                             ";
                         sqlStr = "BEGIN";
-                        DataTable dt = new DataTable();
                         for (int i=0;i<json.Count;i++)
                         {
-                            //读取原注浆记录进行比对,原来 注浆标识 为1 现在 注浆标识 为0 要-1 
-                            dt = conn.GetSqlResultToDt($@"
-                                SELECT  
-                                    GROUTINGLINEDETAILID,
-                                    GROUTINGFLAG
-                                FROM
-                                    TP_PM_GROUTINGDAILYDETAIL
-                                WHERE
-                                    GROUTINGDAILYDETAILID = {json[i]["GROUTINGDAILYDETAILID"].ToString()}
-                            ");
-                            string groutingCount = "";
+                            //验证注浆原因,如果没给数据,置为空
+                            if (!(json[i]["NOGROUTINGRREASON"] is object))
+                                json[i]["NOGROUTINGRREASON"] = "null";
 
-                            //注浆标识改变 才更新 注浆次数
-                            if(json[i]["GROUTINGFLAG"].ToString() != dt.Rows[0]["GROUTINGFLAG"].ToString())
-                            {
-                                groutingCount = json[i]["GROUTINGFLAG"].ToString() == "1" ? "1" : "-1";
-                                sqlStr += updateOne
-                                    .Replace(":GROUTINGCOUNT", groutingCount)
-                                    .Replace(":GROUTINGLINEDETAILID", dt.Rows[0]["GROUTINGLINEDETAILID"].ToString());
-                            }
+                            sqlStr += updateOne
+                                .Replace(":GROUTINGFLAG", json[i]["GROUTINGFLAG"].ToString())
+                                .Replace(":NOGROUTINGRREASON", json[i]["NOGROUTINGRREASON"].ToString())
+                                .Replace(":GROUTINGDAILYDETAILID", json[i]["GROUTINGDAILYDETAILID"].ToString());
+                            //sqlStr += ";";
                         }
                         sqlStr += "END;";
                         result = conn.ExecuteNonQuery(sqlStr);
@@ -1108,9 +1150,10 @@ namespace Dongke.IBOSS.PRD.Service.PDAModuleLogic
                     catch
                     {
                         sre.Status = Constant.ServiceResultStatus.NoSearchResults;
-                        sre.Message = "注浆次数更新失败!";
+                        sre.Message = "注浆记录保存失败!";
                     }
                 }
+
                 //提交
                 if (sre.Status == Constant.ServiceResultStatus.Success)
                     conn.Commit();