| | |
| | | } |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and A.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[] |
| | | search += "and A.wkshp_code in @wkshoplist "; |
| | | dynamicParams.Add("@wkshoplist", wkshoplist); |
| | | } |
| | | if (erpordercode != "" && erpordercode != null) |
| | | { |
| | |
| | | } |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and A.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[] |
| | | search += "and A.wkshp_code in @wkshoplist "; |
| | | dynamicParams.Add("@wkshoplist", wkshoplist); |
| | | } |
| | | if (mesordercode != "" && mesordercode != null) |
| | | { |
| | |
| | | |
| | | |
| | | #region[生产执行,报工调整数据查询接口] |
| | | public static ToMessage MesOrderStepVerifySearch(string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage MesOrderStepVerifySearch(string wkshopcode, string wo_code, string partnumber, string partname, string partspec,string stepcode, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | |
| | | search += "and AA.partspec like '%'+@partspec+'%' "; |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | if (stepcode != "" && stepcode != null) |
| | | { |
| | | search += "and AA.step_code=@stepcode "; |
| | | dynamicParams.Add("@stepcode", stepcode); |
| | | } |
| | | if (reportuser != "" && reportuser != null) |
| | | { |
| | | search += "and AA.usercode like '%'+@reportuser+'%' "; |
| | |
| | | var total = 0; //总条数 |
| | | var sql = @"select * from( |
| | | select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name, |
| | | A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name, |
| | | A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,A.style,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name, |
| | | B.report_person as usercode, |
| | | STUFF((SELECT ',' + U.username |
| | | FROM TUser U |
| | |
| | | where A.style='B' and B.style='B' and M.status<>'CLOSED' and A.verify='N' |
| | | union all |
| | | select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name, |
| | | A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name, |
| | | A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,A.style,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name, |
| | | B.in_person as usercode, |
| | | STUFF((SELECT ',' + U.username |
| | | FROM TUser U |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产执行,报工调整批量改价数据提交] |
| | | public static ToMessage MesOrderStepPriceBatchUpdateSeave(User us, List<BatchPrice> json) |
| | | { |
| | | string sql = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | if (json.Count > 0) |
| | | { |
| | | // 使用Lambda表达式判断类型分布:全部报工或者全部收料 |
| | | bool allB = json.All(p => p.type == "B"); |
| | | bool allS = json.All(p => p.type == "S"); |
| | | if (allB)//全部报工 |
| | | { |
| | | //将List<BatchPrice>中的id字段转换为字符串数组 |
| | | string[] idArray = json.Select(bp => bp.id).ToArray(); |
| | | //回写对应的报工记录主表工价 |
| | | sql = @"update TK_Wrk_Record set step_price=@step_price where id in @idArray and style='B'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | step_price = decimal.Parse(json[0].price), |
| | | idArray = idArray |
| | | } |
| | | }); |
| | | } |
| | | else if (allS)//全部收料 |
| | | { |
| | | //将List<BatchPrice>中的id字段转换为字符串数组 |
| | | string[] idArray = json.Select(bp => bp.id).ToArray(); |
| | | //回写对应的报工记录主表工价 |
| | | sql = @"update TK_Wrk_OutRecord set step_price=@step_price where id in @idArray and style='S'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | step_price = decimal.Parse(json[0].price), |
| | | idArray = idArray |
| | | } |
| | | }); |
| | | } |
| | | else // 混合情况 |
| | | { |
| | | //将List<BatchPrice>中为报工的id字段转换为字符串数组 |
| | | var bList = json.Where(p => p.type == "B").ToList(); |
| | | string[] idBArray = bList.Select(bp => bp.id).ToArray(); |
| | | //回写对应的报工记录主表工价 |
| | | sql = @"update TK_Wrk_Record set step_price=@step_price where id in @idBArray and style='B'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | step_price = decimal.Parse(json[0].price), |
| | | idBArray = idBArray |
| | | } |
| | | }); |
| | | //将List<BatchPrice>中为收料的id字段转换为字符串数组 |
| | | var sList = json.Where(p => p.type == "S").ToList(); |
| | | string[] idSArray = sList.Select(bp => bp.id).ToArray(); |
| | | //回写对应的报工记录主表工价 |
| | | sql = @"update TK_Wrk_OutRecord set step_price=@step_price where id in @idSArray and style='S'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | step_price = decimal.Parse(json[0].price), |
| | | idSArray = idSArray |
| | | } |
| | | }); |
| | | } |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "批量修改工价", "报工ID:" + string.Join(",",json.Select(bp => bp.id).ToArray())+",操作类型:"+ string.Join(",", json.Select(bp => bp.type).ToArray()), us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "操作成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "操作失败!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "请选择需要批量调整工价的报工记录!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | return mes; |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region[生产执行,报工审核列表数据查询接口] |
| | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region[生产入库条码补打] |
| | | public static ToMessage ProductInHouseLabCode(string ordercode) |
| | | { |