|
@@ -50,6 +50,32 @@ func (c StockTemplateController) StockTemplateIn() {
|
|
c.OK(reqData.GetId(), "入库成功")
|
|
c.OK(reqData.GetId(), "入库成功")
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// StockTemplateInScanCode 扫码入库
|
|
|
|
+// @Summary 扫码入库
|
|
|
|
+// @Description 扫码入库
|
|
|
|
+// @Tags 库存
|
|
|
|
+// @Param body body dto.StockTemplateInInsertReq true "body"
|
|
|
|
+// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
|
|
|
+// @Router /stock-template/in [post]
|
|
|
|
+// @Security Bearer
|
|
|
|
+func (c StockTemplateController) StockTemplateInScanCode() {
|
|
|
|
+ s := services.StockTemplate{}
|
|
|
|
+ reqData := dto.BatchStockTemplateInInsertReq{}
|
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ reqData.SetCreateBy(beegouser.GetUserId(c.Ctx))
|
|
|
|
+ reqData.SetDeptId(beegouser.GetDeptId(c.Ctx))
|
|
|
|
+ err := s.StockTemplateInScanCode(&reqData)
|
|
|
|
+ if err != nil {
|
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ c.OK(nil, "扫码入库成功")
|
|
|
|
+}
|
|
|
|
+
|
|
// StockTemplateInEdit 修改入库
|
|
// StockTemplateInEdit 修改入库
|
|
// @Summary 修改入库
|
|
// @Summary 修改入库
|
|
// @Description 修改入库
|
|
// @Description 修改入库
|
|
@@ -154,6 +180,32 @@ func (c StockTemplateController) StockTemplateOut() {
|
|
c.OK(reqData.GetId(), "出库成功")
|
|
c.OK(reqData.GetId(), "出库成功")
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// StockTemplateOutScanCode 扫码出库
|
|
|
|
+// @Summary 扫码出库
|
|
|
|
+// @Description 扫码出库
|
|
|
|
+// @Tags 库存
|
|
|
|
+// @Param body body dto.StockTemplateOutInsertReq true "body"
|
|
|
|
+// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
|
|
|
+// @Router /stock-template/out [post]
|
|
|
|
+// @Security Bearer
|
|
|
|
+func (c StockTemplateController) StockTemplateOutScanCode() {
|
|
|
|
+ s := services.StockTemplate{}
|
|
|
|
+ reqData := dto.BatchStockTemplateOutInsertReq{}
|
|
|
|
+ if err := c.ParseAndValidate(&c.Ctx.Input.RequestBody, &reqData); err != nil {
|
|
|
|
+ c.Error(global.ParseFormErr, err, err.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ reqData.SetCreateBy(beegouser.GetUserId(c.Ctx))
|
|
|
|
+ reqData.SetDeptId(beegouser.GetDeptId(c.Ctx))
|
|
|
|
+ err := s.StockTemplateOutScanCode(&reqData)
|
|
|
|
+ if err != nil {
|
|
|
|
+ c.Error(500, err, err.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ c.OK(nil, "扫码出库成功")
|
|
|
|
+}
|
|
|
|
+
|
|
// StockTemplateOutEdit 修改入库
|
|
// StockTemplateOutEdit 修改入库
|
|
// @Summary 修改入库
|
|
// @Summary 修改入库
|
|
// @Description 修改入库
|
|
// @Description 修改入库
|
|
@@ -398,19 +450,19 @@ func (c StockTemplateController) StockTemplateInventoryExcel(reqData dto.StockTe
|
|
f.SetCellValue("Sheet1", "F4", "收入")
|
|
f.SetCellValue("Sheet1", "F4", "收入")
|
|
f.SetCellValue("Sheet1", "F5", "数量")
|
|
f.SetCellValue("Sheet1", "F5", "数量")
|
|
f.SetCellValue("Sheet1", "G5", "批号")
|
|
f.SetCellValue("Sheet1", "G5", "批号")
|
|
- f.SetCellValue("Sheet1", "H5", "效期")
|
|
|
|
|
|
+ f.SetCellValue("Sheet1", "H5", "失效日期")
|
|
|
|
|
|
f.MergeCell("Sheet1", "I4", "K4")
|
|
f.MergeCell("Sheet1", "I4", "K4")
|
|
f.SetCellValue("Sheet1", "I4", "支出")
|
|
f.SetCellValue("Sheet1", "I4", "支出")
|
|
f.SetCellValue("Sheet1", "I5", "数量")
|
|
f.SetCellValue("Sheet1", "I5", "数量")
|
|
f.SetCellValue("Sheet1", "J5", "批号")
|
|
f.SetCellValue("Sheet1", "J5", "批号")
|
|
- f.SetCellValue("Sheet1", "K5", "效期")
|
|
|
|
|
|
+ f.SetCellValue("Sheet1", "K5", "失效日期")
|
|
|
|
|
|
f.MergeCell("Sheet1", "L4", "N4")
|
|
f.MergeCell("Sheet1", "L4", "N4")
|
|
f.SetCellValue("Sheet1", "L4", "结余")
|
|
f.SetCellValue("Sheet1", "L4", "结余")
|
|
f.SetCellValue("Sheet1", "L5", "数量")
|
|
f.SetCellValue("Sheet1", "L5", "数量")
|
|
f.SetCellValue("Sheet1", "M5", "批号")
|
|
f.SetCellValue("Sheet1", "M5", "批号")
|
|
- f.SetCellValue("Sheet1", "N5", "效期")
|
|
|
|
|
|
+ f.SetCellValue("Sheet1", "N5", "失效日期")
|
|
|
|
|
|
f.MergeCell("Sheet1", "O4", "O5")
|
|
f.MergeCell("Sheet1", "O4", "O5")
|
|
f.SetCellValue("Sheet1", "O4", "经办人签字")
|
|
f.SetCellValue("Sheet1", "O4", "经办人签字")
|
|
@@ -439,17 +491,17 @@ func (c StockTemplateController) StockTemplateInventoryExcel(reqData dto.StockTe
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("B%d", line), v["forwarding_unit"])
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("B%d", line), v["forwarding_unit"])
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("F%d", line), utils.ToInt(v["total_in"]))
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("F%d", line), utils.ToInt(v["total_in"]))
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("G%d", line), v[models.FieldApprovalNumber])
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("G%d", line), v[models.FieldApprovalNumber])
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("H%d", line), v[models.FieldExpiryDate].(time.Time).Format("2006-01-02"))
|
|
|
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("H%d", line), utils.ToDate(v[models.FieldExpiryDate]))
|
|
}
|
|
}
|
|
if utils.ToInt(v["stock_out_id"]) > 0 {
|
|
if utils.ToInt(v["stock_out_id"]) > 0 {
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("B%d", line), v["receiving_unit"])
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("B%d", line), v["receiving_unit"])
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("I%d", line), utils.ToInt(v["total_out"]))
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("I%d", line), utils.ToInt(v["total_out"]))
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("J%d", line), v[models.FieldApprovalNumber])
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("J%d", line), v[models.FieldApprovalNumber])
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("K%d", line), v[models.FieldExpiryDate].(time.Time).Format("2006-01-02"))
|
|
|
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("K%d", line), utils.ToDate(v[models.FieldExpiryDate]))
|
|
}
|
|
}
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("L%d", line), utils.ToInt(v["balance"]))
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("L%d", line), utils.ToInt(v["balance"]))
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("M%d", line), v[models.FieldApprovalNumber])
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("M%d", line), v[models.FieldApprovalNumber])
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("N%d", line), v[models.FieldExpiryDate].(time.Time).Format("2006-01-02"))
|
|
|
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("N%d", line), utils.ToDate(v[models.FieldExpiryDate]))
|
|
|
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("O%d", line), v["operator"])
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("O%d", line), v["operator"])
|
|
|
|
|
|
@@ -547,7 +599,7 @@ func (c StockTemplateController) StockTemplateInventoryPdf(reqData dto.StockTemp
|
|
if utils.ToInt(row["stock_in_id"]) > 0 {
|
|
if utils.ToInt(row["stock_in_id"]) > 0 {
|
|
temp = append(temp, fmt.Sprintf("%d", row["total_in"]))
|
|
temp = append(temp, fmt.Sprintf("%d", row["total_in"]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldExpiryDate].(time.Time).Format("2006-01-02")))
|
|
|
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", utils.ToDate(row[models.FieldExpiryDate])))
|
|
} else {
|
|
} else {
|
|
temp = append(temp, "")
|
|
temp = append(temp, "")
|
|
temp = append(temp, "")
|
|
temp = append(temp, "")
|
|
@@ -557,7 +609,7 @@ func (c StockTemplateController) StockTemplateInventoryPdf(reqData dto.StockTemp
|
|
if utils.ToInt(row["stock_out_id"]) > 0 {
|
|
if utils.ToInt(row["stock_out_id"]) > 0 {
|
|
temp = append(temp, fmt.Sprintf("%d", row["total_out"]))
|
|
temp = append(temp, fmt.Sprintf("%d", row["total_out"]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldExpiryDate].(time.Time).Format("2006-01-02")))
|
|
|
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", utils.ToDate(row[models.FieldExpiryDate])))
|
|
} else {
|
|
} else {
|
|
temp = append(temp, "")
|
|
temp = append(temp, "")
|
|
temp = append(temp, "")
|
|
temp = append(temp, "")
|
|
@@ -566,7 +618,7 @@ func (c StockTemplateController) StockTemplateInventoryPdf(reqData dto.StockTemp
|
|
|
|
|
|
temp = append(temp, fmt.Sprintf("%d", row["balance"]))
|
|
temp = append(temp, fmt.Sprintf("%d", row["balance"]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldExpiryDate].(time.Time).Format("2006-01-02")))
|
|
|
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", utils.ToDate(row[models.FieldExpiryDate])))
|
|
temp = append(temp, fmt.Sprintf("%s", row["operator"]))
|
|
temp = append(temp, fmt.Sprintf("%s", row["operator"]))
|
|
rows = append(rows, temp)
|
|
rows = append(rows, temp)
|
|
|
|
|
|
@@ -621,7 +673,7 @@ func (c StockTemplateController) StockTemplateInventoryPdf(reqData dto.StockTemp
|
|
curx += width
|
|
curx += width
|
|
pdf.SetXY(curx, y+h/2)
|
|
pdf.SetXY(curx, y+h/2)
|
|
width = cols[7]
|
|
width = cols[7]
|
|
- pdf.CellFormat(width, h/2, "效期", "1", 0, "CM", false, 0, "")
|
|
|
|
|
|
+ pdf.CellFormat(width, h/2, "失效日期", "1", 0, "CM", false, 0, "")
|
|
|
|
|
|
// ------支出
|
|
// ------支出
|
|
curx += width
|
|
curx += width
|
|
@@ -641,7 +693,7 @@ func (c StockTemplateController) StockTemplateInventoryPdf(reqData dto.StockTemp
|
|
curx += width
|
|
curx += width
|
|
pdf.SetXY(curx, y+h/2)
|
|
pdf.SetXY(curx, y+h/2)
|
|
width = cols[10]
|
|
width = cols[10]
|
|
- pdf.CellFormat(width, h/2, "效期", "1", 0, "CM", false, 0, "")
|
|
|
|
|
|
+ pdf.CellFormat(width, h/2, "失效日期", "1", 0, "CM", false, 0, "")
|
|
|
|
|
|
// ------结余
|
|
// ------结余
|
|
curx += width
|
|
curx += width
|
|
@@ -661,7 +713,7 @@ func (c StockTemplateController) StockTemplateInventoryPdf(reqData dto.StockTemp
|
|
curx += width
|
|
curx += width
|
|
pdf.SetXY(curx, y+h/2)
|
|
pdf.SetXY(curx, y+h/2)
|
|
width = cols[13]
|
|
width = cols[13]
|
|
- pdf.CellFormat(width, h/2, "效期", "1", 0, "CM", false, 0, "")
|
|
|
|
|
|
+ pdf.CellFormat(width, h/2, "失效日期", "1", 0, "CM", false, 0, "")
|
|
|
|
|
|
curx += width
|
|
curx += width
|
|
width = cols[14]
|
|
width = cols[14]
|
|
@@ -931,7 +983,7 @@ func (c StockTemplateController) TransportRecordWord(reqData dto.TransportRecord
|
|
run = para.AddRun()
|
|
run = para.AddRun()
|
|
run.Properties().SetFontFamily("宋体")
|
|
run.Properties().SetFontFamily("宋体")
|
|
run.Properties().SetSize(9)
|
|
run.Properties().SetSize(9)
|
|
- run.AddText("效期")
|
|
|
|
|
|
+ run.AddText("失效日期")
|
|
|
|
|
|
cell = row.AddCell()
|
|
cell = row.AddCell()
|
|
cell.Properties().SetWidthPercent(6)
|
|
cell.Properties().SetWidthPercent(6)
|
|
@@ -1039,7 +1091,7 @@ func (c StockTemplateController) TransportRecordWord(reqData dto.TransportRecord
|
|
run = para.AddRun()
|
|
run = para.AddRun()
|
|
run.Properties().SetFontFamily("宋体")
|
|
run.Properties().SetFontFamily("宋体")
|
|
run.Properties().SetSize(8)
|
|
run.Properties().SetSize(8)
|
|
- run.AddText(medicineInfo[models.FieldExpiryDate].(time.Time).Format("2006-01-02"))
|
|
|
|
|
|
+ run.AddText(utils.ToDate(medicineInfo[models.FieldExpiryDate]))
|
|
|
|
|
|
cell = row.AddCell()
|
|
cell = row.AddCell()
|
|
cell.Properties().SetWidthPercent(6)
|
|
cell.Properties().SetWidthPercent(6)
|
|
@@ -1689,7 +1741,7 @@ func (c StockTemplateController) TransportRecordPdf(reqData dto.TransportRecordW
|
|
|
|
|
|
cols := []float64{30, 22, 20, 27, 31, 22, 21, 11, 11}
|
|
cols := []float64{30, 22, 20, 27, 31, 22, 21, 11, 11}
|
|
|
|
|
|
- header := []string{"品种", "生产企业", "批准文号", "批签发合格编号", "规格(剂/支或粒)", "批号", "效期", "数量", "单位"}
|
|
|
|
|
|
+ header := []string{"品种", "生产企业", "批准文号", "批签发合格编号", "规格(剂/支或粒)", "批号", "失效日期", "数量", "单位"}
|
|
rows := [][]string{}
|
|
rows := [][]string{}
|
|
for _, row := range list {
|
|
for _, row := range list {
|
|
temp := []string{}
|
|
temp := []string{}
|
|
@@ -1699,7 +1751,7 @@ func (c StockTemplateController) TransportRecordPdf(reqData dto.TransportRecordW
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldQualificationNumber]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldQualificationNumber]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldSpecName]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldSpecName]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldBatchNumber]))
|
|
- temp = append(temp, fmt.Sprintf("%s", row[models.FieldExpiryDate].(time.Time).Format("2006-01-02")))
|
|
|
|
|
|
+ temp = append(temp, fmt.Sprintf("%s", utils.ToDate(row[models.FieldExpiryDate])))
|
|
temp = append(temp, fmt.Sprintf("%d", utils.ToInt(row["quantity"])))
|
|
temp = append(temp, fmt.Sprintf("%d", utils.ToInt(row["quantity"])))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldUnitName]))
|
|
temp = append(temp, fmt.Sprintf("%s", row[models.FieldUnitName]))
|
|
rows = append(rows, temp)
|
|
rows = append(rows, temp)
|
|
@@ -2063,7 +2115,7 @@ func (c StockTemplateController) StockInquiryExcel() {
|
|
f.SetCellValue("Sheet1", "G2", "购进单价")
|
|
f.SetCellValue("Sheet1", "G2", "购进单价")
|
|
f.SetCellValue("Sheet1", "H2", "销售单价")
|
|
f.SetCellValue("Sheet1", "H2", "销售单价")
|
|
f.SetCellValue("Sheet1", "I2", "批号")
|
|
f.SetCellValue("Sheet1", "I2", "批号")
|
|
- f.SetCellValue("Sheet1", "J2", "效期")
|
|
|
|
|
|
+ f.SetCellValue("Sheet1", "J2", "失效日期")
|
|
f.SetCellValue("Sheet1", "K2", "批准文号")
|
|
f.SetCellValue("Sheet1", "K2", "批准文号")
|
|
f.SetCellValue("Sheet1", "L2", "批签发编号")
|
|
f.SetCellValue("Sheet1", "L2", "批签发编号")
|
|
// 设置列宽
|
|
// 设置列宽
|