| | |
| | | var total = 0; //总条数 |
| | | var sql = @"select A.id,A.partcode,A.partname,A.partspec,A.uom_code,B.name as uom_name,D.code as stocktypecode,D.name as stocktypename, |
| | | C.code as materialtypecode,C.name as materialtypename,A.stck_code,T.name as stck_name,A.maxqty,A.minqty,U.username as lm_user,A.default_route, |
| | | A.lm_date,A.proute_id |
| | | A.lm_date,A.proute_id,A.is_batchno,A.is_fifo,A.is_incheck,A.is_outcheck |
| | | from TMateriel_Info A |
| | | left join TUom B on A.uom_code=B.code |
| | | left join TMateriel_Type C on A.materieltype_code=C.code |
| | |
| | | #endregion |
| | | |
| | | #region[存货档案新增编辑] |
| | | public static ToMessage AddUpdateInventoryFile(string materialid, string materialcode, string materialname, string materialspec, string uomcode, string warehousecode, string stocktypecode, string materialtypecode, string minstockqty, string maxstockqty, string username, string operType) |
| | | public static ToMessage AddUpdateInventoryFile(string materialid, string materialcode, string materialname, string materialspec, string uomcode, string warehousecode, string stocktypecode, string materialtypecode, string minstockqty, string maxstockqty,string is_batchno,string is_fifo,string is_incheck,string is_outcheck, string username, string operType) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | var sql = @"insert into TMateriel_Info(partcode,partname,partspec,uom_code,stocktype_code,materieltype_code,stck_code,maxqty,minqty,lm_user,lm_date) |
| | | values(@materialcode,@materialname,@materialspec,@uomcode,@stocktypecode,@materialtypecode,@warehousecode,@maxstockqty,@minstockqty,@username,@CreateDate)"; |
| | | var sql = @"insert into TMateriel_Info(partcode,partname,partspec,uom_code,stocktype_code,materieltype_code,stck_code,maxqty,minqty,lm_user,lm_date,is_batchno,is_fifo,is_incheck,is_outcheck) |
| | | values(@materialcode,@materialname,@materialspec,@uomcode,@stocktypecode,@materialtypecode,@warehousecode,@maxstockqty,@minstockqty,@username,@CreateDate,@is_batchno,@is_fifo,@is_incheck,@is_outcheck)"; |
| | | dynamicParams.Add("@materialcode", materialcode); |
| | | dynamicParams.Add("@materialname", materialname); |
| | | dynamicParams.Add("@materialspec", materialspec); |
| | |
| | | dynamicParams.Add("@maxstockqty", maxstockqty); |
| | | dynamicParams.Add("@username", username); |
| | | dynamicParams.Add("@CreateDate", DateTime.Now.ToString()); |
| | | dynamicParams.Add("@is_batchno", is_batchno); |
| | | dynamicParams.Add("@is_fifo", is_fifo); |
| | | dynamicParams.Add("@is_incheck", is_incheck); |
| | | dynamicParams.Add("@is_outcheck", is_outcheck); |
| | | int cont = DapperHelper.SQL(sql, dynamicParams); |
| | | if (cont > 0) |
| | | { |
| | |
| | | if (operType == "Update") |
| | | { |
| | | var sql = @"update TMateriel_Info set partname=@materialname,partspec=@materialspec,uom_code=@uomcode,stocktype_code=@stocktypecode,materieltype_code=@materialtypecode,stck_code=@warehousecode, |
| | | maxqty=@maxstockqty,minqty=@minstockqty,lm_user=@username,lm_date=@CreateDate where id=@materialid"; |
| | | maxqty=@maxstockqty,minqty=@minstockqty,lm_user=@username,lm_date=@CreateDate,is_batchno=@is_batchno,is_fifo=@is_fifo, |
| | | is_incheck=@is_incheck,is_outcheck=@is_outcheck where id=@materialid"; |
| | | dynamicParams.Add("@materialid", materialid); |
| | | dynamicParams.Add("@materialname", materialname); |
| | | dynamicParams.Add("@materialspec", materialspec); |
| | |
| | | dynamicParams.Add("@maxstockqty", maxstockqty); |
| | | dynamicParams.Add("@username", username); |
| | | dynamicParams.Add("@CreateDate", DateTime.Now.ToString()); |
| | | dynamicParams.Add("@is_batchno", is_batchno); |
| | | dynamicParams.Add("@is_fifo", is_fifo); |
| | | dynamicParams.Add("@is_incheck", is_incheck); |
| | | dynamicParams.Add("@is_outcheck", is_outcheck); |
| | | int cont = DapperHelper.SQL(sql, dynamicParams); |
| | | if (cont > 0) |
| | | { |
| | |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | id = bomid, |
| | | bomid = bomid, |
| | | materiel_code = parentpartcode, |
| | | quantity = quantity, |
| | | status = status, |
| | | username = username, |
| | | CreateDate = DateTime.Now.ToString() |
| | | lm_user = username, |
| | | lm_date = DateTime.Now.ToString() |
| | | } |
| | | }); |
| | | //删除BOM子表 |
| | |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | id = bomid |
| | | bomid = bomid |
| | | } |
| | | }); |
| | | //写入BOM子表 |
| | |
| | | mes.count = 0; |
| | | mes.Message = "工艺路线已被工单引用,不允许删除!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | else |
| | | { |
| | |
| | | mes.count = 0; |
| | | mes.Message = "工艺路线已设置节拍工价,请先删除设置!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | else |
| | | { |
| | |
| | | sql = @"delete TMateriel_Route where route_code=@routecode"; |
| | | list.Add(new { str = sql, parm = new { routecode = routecode } }); |
| | | } |
| | | } |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "删除成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "删除失败!"; |
| | | mes.data = null; |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "删除成功!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "删除失败!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | return mes; |
| | | } |
| | |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |