| | |
| | | /// <param name="isControlled">是否受控</param> |
| | | /// <param name="isInspect">是否免检</param> |
| | | /// <param name="environment">存储环境</param> |
| | | /// <param name="categoryNo">类别编码</param> |
| | | /// <returns></returns> |
| | | public List<MaterialsDto> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment) |
| | | public List<MaterialsDto> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo) |
| | | { |
| | | string str = "select mate.*,user1.RealName CreateUserName,pack.PackagName PackagName,unit.UnitName UnitName from SysMaterials mate left join SysUserInfor user1 on mate.CreateUser = user1.Id left join SysPackag pack on mate.PackagNo = pack.PackagNo left join SysUnit unit on mate.UnitNo = unit.UnitNo where mate.IsDel = @isdel"; |
| | | string str = "select mate.*,user1.RealName CreateUserName,pack.PackagName PackagName,unit.UnitName UnitName,matec.CategoryName from SysMaterials mate left join SysUserInfor user1 on mate.CreateUser = user1.Id left join SysPackag pack on mate.PackagNo = pack.PackagNo left join SysUnit unit on mate.UnitNo = unit.UnitNo left join SysMaterialCategory matec on mate.CategoryNo = matec.CategoryNo where mate.IsDel = @isdel"; |
| | | //判断物料编码 |
| | | if (!string.IsNullOrEmpty(skuNo)) |
| | | { |
| | |
| | | { |
| | | str += " and mate.Environment = @environment"; |
| | | } |
| | | //判断物料类别是否为空 |
| | | if (!string.IsNullOrWhiteSpace(categoryNo)) |
| | | { |
| | | str += " and mate.CategoryNo = @categoryNo"; |
| | | } |
| | | List<MaterialsDto> matedto = Db.Ado.SqlQuery<MaterialsDto>(str, new |
| | | { |
| | | isdel = "0", //是否删除 |
| | |
| | | iscontrolled = isControlled,// 是否受控 |
| | | isinspect = isInspect,// 是否免检 |
| | | environment = environment,// 存储环境 |
| | | categoryNo = categoryNo, //物料类别 |
| | | }); |
| | | return matedto; |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public async Task<int> AddMate(SysMaterials mate) |
| | | { |
| | | string str = "insert into SysMaterials values(@skuno, @skuname, @standard, @auditstatusno, @type, @iscontrolled, @isinspect, @origin, @unitno, @packagno, @environment, @weight, @warranty, @price,null,null, @demo, @isdel, @createTime, @createUser, null, null,@adventtime,@lowinventory)"; |
| | | string str = "insert into SysMaterials values(@skuno, @skuname, @standard, @auditstatusno, @type, @iscontrolled, @isinspect, @origin, @unitno, @packagno, @environment, @weight, @warranty, @price,null,null,null,null,null,null,null,null,null,null,null, @demo, @isdel, @createTime, @createUser, null, null,@adventtime,@lowinventory,@categoryNo)"; |
| | | mate.CreateTime = Db.GetDate(); |
| | | int i = await Db.Ado.ExecuteCommandAsync(str, new |
| | | { |
| | |
| | | createtime = Db.GetDate(), //创建时间 |
| | | createUser = mate.CreateUser, //创建人 |
| | | adventtime = mate.AdventTime, //临期 |
| | | lowinventory = mate.LowInventory //低库存 |
| | | lowinventory = mate.LowInventory, //低库存 |
| | | categoryNo = mate.CategoryNo, //类别编码 |
| | | }); |
| | | return i; |
| | | } |
| | |
| | | public async Task<int> ExitMate(SysMaterials mate) |
| | | { |
| | | |
| | | string str = "update SysMaterials set SkuName = @skuname, Standard = @standard, AuditStatusNo = @auditstatusno, Type = @type, IsControlled = @iscontrolled, IsInspect = @isinspect, UnitNo = @unitno, PackagNo = @packagno, Environment = @environment, Weight = @weight, Warranty = @warranty, Price = @price, Demo = @demo, UpdateTime = @updatetime, UpdateUser = @updateuser,AdventTime = @adventtime,LowInventory = @lowinventory where Id = @id"; |
| | | string str = "update SysMaterials set SkuName = @skuname, Standard = @standard, AuditStatusNo = @auditstatusno, Type = @type, IsControlled = @iscontrolled, IsInspect = @isinspect, UnitNo = @unitno, PackagNo = @packagno, Environment = @environment, Weight = @weight, Warranty = @warranty, Price = @price, Demo = @demo, UpdateTime = @updatetime, UpdateUser = @updateuser,AdventTime = @adventtime,LowInventory = @lowinventory,CategoryNo = @categoryNo where Id = @id"; |
| | | int i = await Db.Ado.ExecuteCommandAsync(str, new |
| | | { |
| | | skuname = mate.SkuName, //物料名称 |
| | |
| | | updateuser = mate.UpdateUser, //更改人 |
| | | adventtime = mate.AdventTime, //临期 |
| | | lowinventory = mate.LowInventory, //低库存 |
| | | categoryNo = mate.CategoryNo, //类别编码 |
| | | id = mate.Id //id |
| | | }); |
| | | return i; |