| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 设备节拍维护 设置列表/保存/编辑/删除方法 |
| | | /// <summary> |
| | | /// 项目费用分类 保存 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("SaveSb_EqiupMaterWorkTime")] |
| | | [HttpPost] |
| | | public object SaveSb_EqiupMaterWorkTime([FromBody] JObject msg) |
| | | { |
| | | DataSet ds; |
| | | var _value = msg["msg"].ToString(); |
| | | string msg3 = _value.ToString(); |
| | | string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg1 = sArray[0].ToString(); |
| | | string msg2 = sArray[1].ToString(); |
| | | |
| | | |
| | | Int64 HItemID = 0; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | //获取最大ID值赋值 |
| | | DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from EqiupMaterWorkTimes ", "EqiupMaterWorkTimes"); |
| | | if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) |
| | | { |
| | | //HItemID= Maxds.Tables[0].Rows[0]["HItemID"] |
| | | var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]); |
| | | maxid += 1; |
| | | HItemID = maxid; |
| | | } |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | //保存权限 |
| | | if (!DBUtility.ClsPub.Security_Log("EqiupMaterWorkTimes_Edit", 1, false, msg2)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无保存权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | WebAPI.DLL.ClsEqiupMaterWorkTimes_Ctl oBill = new WebAPI.DLL.ClsEqiupMaterWorkTimes_Ctl(); |
| | | List<Model.ClsEqiupMaterWorkTimes_Model> lsmain = new List<Model.ClsEqiupMaterWorkTimes_Model>(); |
| | | msg1 = msg1.Replace("\\", ""); |
| | | msg1 = msg1.Replace("\n", ""); |
| | | lsmain = oListModels.getObjectByJson_EqiupMaterWorkTimes(msg1); |
| | | foreach (ClsEqiupMaterWorkTimes_Model item in lsmain) |
| | | { |
| | | oBill.oModel = item; |
| | | } |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (oBill.oModel.HItemID == 0) |
| | | { |
| | | bResult = oBill.AddNew(); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyByID(oBill.oModel.HItemID); |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | 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) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设备节拍维护 获取信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("GetEqiupMaterWorkTimeDetail")] |
| | | [HttpGet] |
| | | public ApiResult<DataSet> GetEqiupMaterWorkTimeDetail(string HID) |
| | | { |
| | | var model = LuBaoSevice.GetEqiupMaterWorkTimeDetail(HID); |
| | | return model; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设备节拍维护 删除功能 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("DeltetEqiupMaterWorkTime")] |
| | | [HttpGet] |
| | | public object DeltetEqiupMaterWorkTime(string HItemID, string user) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | //删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("EqiupMaterWorkTimes_Delete", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无删除权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (string.IsNullOrWhiteSpace(HItemID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HItemID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | ds = oCN.RunProcReturn("select * from EqiupMaterWorkTimes where HItemID=" + HItemID, "EqiupMaterWorkTimes"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能进行删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已禁用!不能进行删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | oCN.RunProc("delete from EqiupMaterWorkTimes where HItemID=" + HItemID); |
| | | |
| | | |
| | | oCN.Commit();//提交事务 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "数据删除成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// 用关联工序获取信息 |
| | |
| | | /// <returns></returns> |
| | | [Route("Web/GetSc_ProcessExchangeBillListView")] |
| | | [HttpGet] |
| | | public object GetSc_ProcessExchangeBillListView(string ICMOBill, int OrganizationID) |
| | | { |
| | | if (ICMOBill != "" & ICMOBill != null) |
| | | { |
| | | sWhere = " where 1=1 and 单据号 like '%" + ICMOBill + "%' "; |
| | | } |
| | | public object GetSc_ProcessExchangeBillListView(string sWhere,int OrganizationID) |
| | | { |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessExchangeBillList where 1=1 order by 单据号 desc,hsubid", "h_v_Sc_ProcessExchangeBillList"); |
| | | } |
| | | ds = oCN.RunProcReturn("select top 300 * from h_v_Sc_ProcessExchangeBillList where 1=1 order by 单据号 desc,hsubid", "h_v_Sc_ProcessExchangeBillList"); |
| | | } |
| | | else |
| | | { |
| | | string sql = "select * from h_v_Sc_ProcessExchangeBillList " + sWhere + " order by 单据号 desc,hsubid "; |
| | | string sql = "select * from h_v_Sc_ProcessExchangeBillList where 1=1 " + sWhere + " order by 单据号 desc,hsubid "; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessExchangeBillList"); |
| | | } |
| | | if (ds == null || ds.Tables[0].Rows.Count <= 0) |