| | |
| | | { |
| | | DataSet ds; |
| | | var _value = msg["msg"].ToString(); |
| | | cs(_value); |
| | | string msg3 = _value.ToString(); |
| | | string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg1 = sArray[0].ToString(); |
| | |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | //} |
| | | //查询数据中是否存在重复代码 |
| | | ds = oCN.RunProcReturn("select * from Gy_Material where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Material"); |
| | | if (oItem.HNumber.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!代码为空!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //新增时判断 |
| | | #region 父级校验方法(api调用先注释掉,) |
| | | /* |
| | | if (oItem.HItemID == 0) |
| | | { |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | |
| | | } |
| | | else |
| | | if (ds == null || ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | } |
| | | } |
| | | } |
| | | */ |
| | | #endregion |
| | | //得到短代码 |
| | | string sShortNumber; |
| | | sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); |
| | |
| | | oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //等级 |
| | | oBill.oModel = oItem; |
| | | } |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (oBill.oModel.HItemID == 0) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddNew(); |
| | | } |
| | | else |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | [Route("Gy_Material/SaveGy_MaterialListApi")] |
| | | [HttpPost] |
| | | public object SaveGy_MaterialListApi([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["model"].ToString(); |
| | | string msg3 = _value.ToString(); |
| | | string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg1 = sArray[0].ToString(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | DLL.ClsGy_Material_Ctl oBill = new DLL.ClsGy_Material_Ctl(); |
| | | List<Models.ClsGy_Material_Model> lsmain = new List<Models.ClsGy_Material_Model>(); |
| | | msg1 = msg1.Replace("\\", ""); |
| | | msg1 = msg1.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_Material(msg1); |
| | | oBill.oModel = lsmain[0]; |
| | | //保存 |
| | | bool bResult = oBill.AddNewApi(); |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("物料同步插件,保存方法执行完成异常:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff:ffffff")+ e.Message.ToString()); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 物料设置删除功能 |
| | |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (user == "10000")//api同步方式 |
| | | { |
| | | oCN.RunProc("delete from Gy_Material where HERPItemID=" + HItemID); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "* 数据删除成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | //删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_Material_Delete", 1, false, user)) |
| | | { |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (string.IsNullOrWhiteSpace(HItemID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_MouldFileList"); |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | | //{ |
| | | //objJsonResult.code = "0"; |
| | | //objJsonResult.count = 0; |
| | | //objJsonResult.Message = "无数据"; |
| | | //objJsonResult.data = null; |
| | | //return objJsonResult; |
| | | //} |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | Double HProdQty = mainList[0].HProdQty; |
| | | Double HProdWeight = mainList[0].HProdWeight; |
| | | string HRemark = mainList[0].HRemark; |
| | | string HMaker = mainList[0].HMaker; |
| | | string HUpDater = mainList[0].HUpDater; |
| | | string HMaterNumber = mainList[0].HMaterNumber; |
| | | string HSupNumber = mainList[0].HSupNumber; |
| | | long HPrintQty = mainList[0].HPrintQty; |
| | |
| | | ",HYear='" + HYear.ToString() + "'" + |
| | | ",HPeriod='" + HPeriod.ToString() + "'" + |
| | | ",HRemark='" + HRemark + "'" + |
| | | ",HUpDater='" + HMaker + "'" + |
| | | ",HUpDater='" + HUpDater + "'" + |
| | | ",HUpDateDate=getdate()" + |
| | | //======================================== |
| | | ",HMouldNo='" + HMouldNo + "'" + |
| | |
| | | ",HNowSupID=" + HNowSupID.ToString() + |
| | | ",HNowSupTypeID=" + HNowSupTypeID.ToString() + |
| | | ",HProdWeight=" + HProdWeight.ToString() + |
| | | ",HBarCode=" + HBarCode.ToString() + |
| | | ",HBarCode='" + HBarCode.ToString() + "'" + |
| | | " where HInterID=" + HInterID.ToString()); |
| | | |
| | | //修改子项目代码 |