WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -1169,6 +1169,99 @@
        }
        #endregion
        #region 指引卡变更单 新增保存
        [Route("MES_Sc_ProcessExchangeBillMain_Note_PDA/ProcessExchangeBillMain_NoteAddBill")]
        [HttpPost]
        public object ProcessExchangeBillMain_NoteAddBill([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            try
            {
                //反序列化
                string msg2 = "[" + sArray[0].ToString() + "]";
                string user = sArray[1].ToString();//用户名
                string OperationType = sArray[2].ToString();//类型
                //判断是否有编辑权限
                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Change", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无变更权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                List<Model.Sc_ProcessExchangeBillMain_Note> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.Sc_ProcessExchangeBillMain_Note>>(msg2);
                long HSouceID_Original = list[0].HSouceID_Original;
                long HSouceID_Now = list[0].HSouceID_Now;
                long HOrgID = list[0].HOrgID;//组织ID
                String HICMOBillNo = list[0].HICMOBillNo;//任务单
                long HICMOInterID = list[0].HICMOInterID;//任务单ID
                long HProcExchInterID = list[0].HProcExchInterID;
                long HProcExchEntryID = list[0].HProcExchEntryID;
                String HProcExchBillNo = list[0].HProcExchBillNo;
                String HBillNo_Note = list[0].HBillNo_Note;//指引卡
                long HMaterID = list[0].HMaterID;//产品ID
                long HUnitID = list[0].HUnitID;//计量单位
                long HProcID = list[0].HProcID;//工序ID
                string HMaker = user;//制单人
                string HMakeDate = list[0].HMakeDate;//制单日期
                //单据完整性判断
                if (HProcExchBillNo == "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "流转卡没有选择!请扫描条形码或输入条形码后回车";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (OperationType == "1")
                {
                    oCN.RunProc("Insert Into Sc_ProcessExchangeBillMain_Note " +
                    "(HBillNo_Note,HSouceID_Original,HSouceID_Now,HOrgID,HICMOInterID,HICMOBillNo,HProcExchBillNo,HProcExchInterID" +
                    ",HProcExchEntryID,HMaterID,HUnitID,HProcID,HMaker,HMakeDate)" +
                    " values('" + HBillNo_Note + "','" + HSouceID_Original + "'," + HSouceID_Now + ",'" + HOrgID + "'," + HICMOInterID + ",'"+ HICMOBillNo + "','" + HProcExchBillNo + "' ," + HProcExchInterID +
                    "," + HProcExchEntryID + ",'" + HMaterID + "','" + HUnitID + "'," + HProcID + ",'" + HMaker + "','" + HMakeDate + "')" );
                    oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=" + HSouceID_Now + " where HInterID=" + HProcExchInterID + " and HEntryID=" + HProcExchEntryID);
                }
                else
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "操作类型无效!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "新增单据成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 出站汇报单显示表体明细
        [Route("Cj_StationEntrustInBill/DisBillEntryList")]