| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //工艺路线孙表 新增 |
| | | [Route("Gy_RoutingBillSub/AddWorkQty")] |
| | | [HttpPost] |
| | | public object AddWorkQty([FromBody] JObject sMainSub) |
| | | { |
| | | try |
| | | { |
| | | var _value = sMainSub["sMainSub"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string user = sArray[1].ToString(); |
| | | |
| | | //判断是否有编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "工艺路线无权限编辑!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | List<Gy_RoutingBillSub_WorkQty> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_RoutingBillSub_WorkQty>>(msg2); |
| | | int i = 0; |
| | | |
| | | oCN.BeginTran();//开始事物 |
| | | |
| | | foreach (Gy_RoutingBillSub_WorkQty oSub in DetailColl) |
| | | { |
| | | i++; |
| | | |
| | | if (i == 1) |
| | | { |
| | | //先删除历史绑定数据后在重新保存 |
| | | oCN.RunProc("delete from Gy_RoutingBillSub_WorkQty where HInterID = " + oSub.HInterID + " and HEntryID = " + oSub.HEntryID); |
| | | }; |
| | | |
| | | oCN.RunProc($"insert into Gy_RoutingBillSub_WorkQty" + |
| | | $"(HInterID,HEntryID,HEntrySubID,HSourceID,HWorkQty_Source,HEntryStdEmpQty,HEntryStdEmpAvg,HSortNum,HRemark)" + |
| | | $"values({oSub.HInterID},{oSub.HEntryID},{i},{oSub.HSourceID},{oSub.HWorkQty_Source},{oSub.HEntryStdEmpQty}" + |
| | | $",{oSub.HEntryStdEmpAvg},{oSub.HSortNum},'{oSub.HRemark}')"); |
| | | } |
| | | |
| | | 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("Gy_RoutingBill/EditWorkQty")] |
| | | [HttpGet] |
| | | public object EditWorkQty(long HInterID,long HEntryID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn($"select * from h_v_Gy_RoutingBillSub_WorkQtyEdit where hmainid={HInterID} and hsubid={HEntryID} order by HEntrySubID asc", "h_v_Gy_RoutingBillSub_WorkQtyEdit"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "false!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 临时定额报表 |