|
@@ -67,6 +67,8 @@ func StockManagerApiRegistRouters() {
|
67
|
67
|
beego.Router("/api/warehouseout/postsearchstock", &StockManagerApiController{}, "Get:PostSearchStock")
|
68
|
68
|
|
69
|
69
|
beego.Router("/api/warehouseout/getoutstocktotalcount", &StockManagerApiController{}, "Get:GetOutStockTotalCount")
|
|
70
|
+
|
|
71
|
+ beego.Router("/api/good/postgoodinformation", &StockManagerApiController{}, "Post:AddGoodInformation")
|
70
|
72
|
}
|
71
|
73
|
|
72
|
74
|
func (c *StockManagerApiController) CreateWarehouse() {
|
|
@@ -1379,7 +1381,7 @@ func (c *StockManagerApiController) EditWarehouseOut() {
|
1379
|
1381
|
sys_record_time := int64(items["sys_record_time"].(float64))
|
1380
|
1382
|
|
1381
|
1383
|
warehouseOutInfo := &models.WarehouseOutInfo{
|
1382
|
|
- ID: id,
|
|
1384
|
+ ID: id,
|
1383
|
1385
|
WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
|
1384
|
1386
|
WarehouseOutId: warehouseOut.ID,
|
1385
|
1387
|
GoodId: good_id,
|
|
@@ -1804,10 +1806,16 @@ func (c *StockManagerApiController) GetQueryInfo() {
|
1804
|
1806
|
}
|
1805
|
1807
|
adminUserInfo := c.GetAdminUserInfo()
|
1806
|
1808
|
list, total, err := service.FindAllStockInfo(adminUserInfo.CurrentOrgId, page, limit, keyword, startTime, endTime, type_name)
|
|
1809
|
+ info, err := service.GetCoutWareseOutInfo(startTime, endTime, adminUserInfo.CurrentOrgId)
|
|
1810
|
+
|
|
1811
|
+ infomationList, err := service.GetGoodInfomationList(adminUserInfo.CurrentOrgId)
|
1807
|
1812
|
if err == nil {
|
1808
|
1813
|
c.ServeSuccessJSON(map[string]interface{}{
|
1809
|
|
- "list": list,
|
1810
|
|
- "total": total,
|
|
1814
|
+ "list": list,
|
|
1815
|
+ "total": total,
|
|
1816
|
+ "info": info,
|
|
1817
|
+ "infomationList": infomationList,
|
|
1818
|
+ "orgid": adminUserInfo.CurrentOrgId,
|
1811
|
1819
|
})
|
1812
|
1820
|
} else {
|
1813
|
1821
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
@@ -1993,3 +2001,62 @@ func (this *StockManagerApiController) GetOutStockTotalCount() {
|
1993
|
2001
|
"stockCount": stockCount,
|
1994
|
2002
|
})
|
1995
|
2003
|
}
|
|
2004
|
+
|
|
2005
|
+func (this *StockManagerApiController) AddGoodInformation() {
|
|
2006
|
+ dataBody := make(map[string]interface{}, 0)
|
|
2007
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
2008
|
+ if err != nil {
|
|
2009
|
+ utils.ErrorLog(err.Error())
|
|
2010
|
+ return
|
|
2011
|
+ }
|
|
2012
|
+ utils.ErrorLog("%v", dataBody)
|
|
2013
|
+
|
|
2014
|
+ tempGoods := dataBody["goods"].([]interface{})
|
|
2015
|
+ fmt.Println("3333333333", tempGoods)
|
|
2016
|
+ var goods []*models.GoodInfo
|
|
2017
|
+ for index, goodMap := range tempGoods {
|
|
2018
|
+ goodNameM := goodMap.(map[string]interface{})
|
|
2019
|
+ fmt.Println("00000", goodNameM)
|
|
2020
|
+ var good models.GoodInfo
|
|
2021
|
+ if goodNameM["good_name"] == nil || reflect.TypeOf(goodNameM["good_name"]).String() != "string" {
|
|
2022
|
+ utils.ErrorLog("good_name")
|
|
2023
|
+ return
|
|
2024
|
+ }
|
|
2025
|
+
|
|
2026
|
+ good_name, _ := goodNameM["good_name"].(string)
|
|
2027
|
+ if len(good_name) == 0 { //名字为空则生成一条导入错误日志
|
|
2028
|
+ err_log := models.ExportErrLog{
|
|
2029
|
+ LogType: 5,
|
|
2030
|
+ UserOrgId: this.GetAdminUserInfo().CurrentOrgId,
|
|
2031
|
+ ErrMsg: "第" + strconv.Itoa(index+3) + "行" + "的耗材名称不能为空",
|
|
2032
|
+ Status: 1,
|
|
2033
|
+ CreateTime: time.Now().Unix(),
|
|
2034
|
+ UpdateTime: time.Now().Unix(),
|
|
2035
|
+ ExportTime: time.Now().Unix(),
|
|
2036
|
+ }
|
|
2037
|
+ service.CreateExportErrLog(&err_log)
|
|
2038
|
+ continue
|
|
2039
|
+ }
|
|
2040
|
+ fmt.Println("33333333", good_name)
|
|
2041
|
+ good.GoodName = good_name
|
|
2042
|
+ if goodNameM["medical_insurance_level"] == nil || reflect.TypeOf(goodNameM["medical_insurance_level"]).String() != "string" {
|
|
2043
|
+ utils.ErrorLog("medical_insurance_level")
|
|
2044
|
+ return
|
|
2045
|
+ }
|
|
2046
|
+ medical_insurance_level := goodNameM["medical_insurance_level"].(string)
|
|
2047
|
+ medical_insurance_levels, _ := strconv.ParseInt(medical_insurance_level, 10, 64)
|
|
2048
|
+ good.MedicalInsuranceLevel = medical_insurance_levels
|
|
2049
|
+
|
|
2050
|
+ goods = append(goods, &good)
|
|
2051
|
+ }
|
|
2052
|
+ adminUser := this.GetAdminUserInfo()
|
|
2053
|
+ orgId := adminUser.CurrentOrgId
|
|
2054
|
+ if len(goods) > 0 {
|
|
2055
|
+ for _, item := range goods {
|
|
2056
|
+ service.CreateGoodsInfomation(item, orgId)
|
|
2057
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2058
|
+ "msg": "导入成功",
|
|
2059
|
+ })
|
|
2060
|
+ }
|
|
2061
|
+ }
|
|
2062
|
+}
|